public async Task <ActionResult> DeleteConfirmed(int id) { await _menuTypeDal.DeleteByIdAsync(id); WebContentManage.RefreshMenuTypes(); return(RedirectToAction("Index")); }
// GET: Admin/WebContents public async Task <ActionResult> Index(string menuTypeId, string webContentTypeId, string currentFilter, string searchString, int?page) { if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CurrentFilter = searchString; ViewBag.MenuTypeId = menuTypeId; ViewBag.WebContentTypeId = webContentTypeId; IEnumerable <WebContent> entityList = await WebContentManage.QueryByMenuTypeIdAndWebContentTypeId(menuTypeId, webContentTypeId); if (entityList.Any()) { if (!String.IsNullOrEmpty(searchString)) { entityList = entityList.Where(s => (s.Content != null && s.Content.Contains(searchString)) || (s.Title != null && s.Title.Contains(searchString)) || (s.Creater != null && s.Creater.Contains(searchString)) || (s.LastModifier != null && s.LastModifier.Contains(searchString))); } entityList = entityList.OrderByDescending(s => s.LastModifyDate); } ViewBag.MenuTypes = await WebContentManage.QuerySelectListMenuTypes(); ViewBag.WebContentTypes = await WebContentManage.QuerySelectListWebContentTypesByMenuTypeId(menuTypeId); int pageSize = 10; int pageNumber = (page ?? 1); return(View(entityList.ToPagedList(pageNumber, pageSize))); }
// GET: Admin/WebContentTypes/Create public async Task <ActionResult> Create() { var webContentType = new WebContentType(); webContentType.MenuTypeList = WebContentManage.QueryMenuTypes(); // await _menuTypeDal.QueryAllAsync(); return(View(webContentType)); }
// GET: WebContents public async Task <ActionResult> Index(int webContentTypeId, string currentFilter, string searchString, int?page) { if (searchString != null) { page = 1; } else { searchString = currentFilter; } IEnumerable <WebContent> entityList = new List <WebContent>(); ViewBag.CurrentFilter = searchString; ViewBag.WebContentTypeId = webContentTypeId; entityList = await _webContentDal.QueryByFunAsync(t => t.WebContentTypeId == webContentTypeId); if (entityList.Any()) { if (!String.IsNullOrEmpty(searchString)) { entityList = entityList.Where(s => (s.Content != null && s.Content.Contains(searchString)) || (s.Title != null && s.Title.Contains(searchString)) || (s.Creater != null && s.Creater.Contains(searchString)) || (s.LastModifier != null && s.LastModifier.Contains(searchString))); } entityList = entityList.OrderBy(s => s.DisplayOrder); } int pageSize = 20; int pageNumber = (page ?? 1); ViewBag.Title = WebContentManage.QueryWebContentTypeById(webContentTypeId).Name; return(View(entityList.ToPagedList(pageNumber, pageSize))); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Name,CreateDate,LastModifyDate,IsDelete,Creater,LastModifier")] MenuType menuType) { if (!string.IsNullOrEmpty(menuType.Name)) { await _menuTypeDal.ModifyAsync(menuType); WebContentManage.RefreshMenuTypes(); return(RedirectToAction("Index")); } return(View(menuType)); }
public async Task <ActionResult> Create(WebContentType webContentType) { if (!string.IsNullOrEmpty(webContentType.Name)) { InitInsert(webContentType); await _webContentTypeDal.InsertAsync(webContentType); WebContentManage.RefreshWebContentTypes(); return(RedirectToAction("Index")); } webContentType.MenuTypeList = WebContentManage.QueryMenuTypes();// await _menuTypeDal.QueryAllAsync(); return(View(webContentType)); }
public async Task <ActionResult> Edit(WebContentType webContentType) { if (!string.IsNullOrEmpty(webContentType.Name)) { InitModify(webContentType); await _webContentTypeDal.ModifyAsync(webContentType); WebContentManage.RefreshWebContentTypes(); return(RedirectToAction("Index")); } webContentType.MenuType = WebContentManage.QueryMenuTypeById(webContentType.MenuTypeId); // await _menuTypeDal.QueryByIdAsync(webContentType.MenuTypeId); webContentType.MenuTypeList = WebContentManage.QueryMenuTypes(); // await _menuTypeDal.QueryAllAsync(); return(View(webContentType)); }
// GET: Admin/WebContentTypes/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WebContentType webContentType = WebContentManage.QueryWebContentTypeById((int)id);// await _webContentTypeDal.QueryByIdAsync(id); if (webContentType == null) { return(HttpNotFound()); } webContentType.MenuType = WebContentManage.QueryMenuTypeById(webContentType.MenuTypeId);// await _menuTypeDal.QueryByIdAsync(webContentType.MenuTypeId); return(View(webContentType)); }
// GET: Admin/WebContentTypes public async Task <ActionResult> Index(string sortOrder, string currentFilter, string searchString, int?page) { ViewBag.CurrentSort = sortOrder; ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : ""; if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CurrentFilter = searchString; var entityList = WebContentManage.QueryWebContentTypes();//await _webContentTypeDal.QueryAllAsync(); foreach (var entity in entityList) { entity.MenuType = WebContentManage.QueryMenuTypeById(entity.MenuTypeId);// await _menuTypeDal.QueryByIdAsync(entity.MenuTypeId); } if (entityList.Any()) { if (!String.IsNullOrEmpty(searchString)) { entityList = entityList.Where(s => s.Name != null && s.Name.Contains(searchString)); } switch (sortOrder) { case "name_desc": entityList = entityList.OrderByDescending(s => s.Name); break; default: // Name ascending entityList = entityList.OrderBy(s => s.Name); break; } } int pageSize = 10; int pageNumber = (page ?? 1); return(View(entityList.ToPagedList(pageNumber, pageSize))); }