public ActionResult Create() { ViewBag.сontent_id = new SelectList(_contentsHandler.All(), "id", "title"); ViewBag.menuType_id = new SelectList(menutypesHandler.All(), "id", "title"); ViewBag.site_id = new SelectList(sitesHandler.All(), "id", "title"); return(View()); }
public ActionResult Index(int?page, int?site, string search, string orderFeild, string prevOrder, int?category) { IQueryable <Contents> content = _contentHandler.All(); //filter if (category != null && category != 0) { content = content.Where(c => c.category_id == category); } List <Categories> categories = _categoriesHandler.All().ToList(); categories.Insert(0, new Categories { id = 0, title = "All" }); ViewBag.category = new SelectList(categories, "id", "title"); if (site != null && site != 0) { content = content.Where(c => c.site_id == site); } List <Sites> sites = _sitesHandler.All().ToList(); sites.Insert(0, new Sites { id = 0, title = "All" }); ViewBag.site = new SelectList(sites, "id", "title"); //search content = _contentHandler.Search(content, search); //sorting content = _contentHandler.Sorting(content, ref orderFeild, ref prevOrder); //сохранение состояния выбора пользователя ViewBag.SearchState = search; ViewBag.PrevState = prevOrder; ViewBag.CategoryState = category; ViewBag.SiteState = site; var contentMapper = Mapper.Map <IEnumerable <Contents>, List <ContentViewModel> >(content); int pageSize = PagingSettings.PageSizeInContent; int pageNumber = (page ?? 1); return(View(contentMapper.ToPagedList(pageNumber, pageSize))); }
public ActionResult Create() { ViewBag.site_id = new SelectList(sitesHandler.All(), "id", "title"); return(View()); }
public ActionResult Index() { var sites = sitesHandler.All(); return(View(sites)); }