using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Service; using Domain; namespace WebSite.Controllers { public class RoomModalController : BaseController { private const int AuthorityID = 20; public IRoomModalManager RoomModalManager { get; set; } #region Action [Authorize] public ActionResult Index() { return View(); } [Authorize] public ActionResult Edit(string id) { return View(RoomModalManager.Get(id)); } [Authorize] public ActionResult LoadAllByPage(int page, int rows, string order, string sort) { long total = 0; var list = this.RoomModalManager.LoadAllByPage(out total, page, rows, order, sort); //var result = list.Select(r => new { r.ID, r.Number, r.ModalName, r.Name, r.Type, r.Remark, @checked = true }); return Json(new { total = total, rows = list }); } [Authorize] public ActionResult LoadAll() { return Json(RoomModalManager.LoadAll().OrderBy(r => r.Sort).ToList()); } /// /// 修改自定义名称 /// /// /// /// [Authorize] public ActionResult ChangeName(string ID, string Name) { RoomModal modal = RoomModalManager.Get(ID); if (String.IsNullOrEmpty(ID) || modal == null) { return Json(new { IsSuccess = false, Message = HttpContext.InnerLanguage("InvalidOperation") }); } if (String.IsNullOrEmpty(Name)) { return Json(new { IsSuccess = false, Message = HttpContext.InnerLanguage("CustomNameCanNotBeEmpty") }); } modal.Name = Name; RoomModalManager.Save(modal); SaveSystemLog(AuthorityID, HttpContext.InnerLanguage("EditingEquipment"), Name); return Json(new { IsSuccess = true, Message = HttpContext.InnerLanguage("SaveSuccess") }); } #endregion } }