public PartialViewResult EditSortOrder() { var customPages = HttpRequestStorage.DatabaseEntities.CustomPages; EditSortOrderInMenuGroupViewModel viewModel = new EditSortOrderInMenuGroupViewModel(); return(ViewEditSortOrder(customPages, viewModel)); }
public ActionResult EditSortOrder(EditSortOrderInMenuGroupViewModel viewModel) { var customPages = HttpRequestStorage.DatabaseEntities.CustomPages; if (!ModelState.IsValid) { return(ViewEditSortOrder(customPages, viewModel)); } viewModel.UpdateModel(new List <IHaveASortOrder>(customPages)); SetMessageForDisplay($"Successfully Updated Custom Page Sort Order"); return(new ModalDialogFormJsonResult()); }
private PartialViewResult ViewEditSortOrder(IQueryable <CustomPage> customPages, EditSortOrderInMenuGroupViewModel viewModel) { var aboutCustomPages = customPages.Where(x => x.FirmaMenuItemID == FirmaMenuItem.About.FirmaMenuItemID); var projectsCustomPages = customPages.Where(x => x.FirmaMenuItemID == FirmaMenuItem.Projects.FirmaMenuItemID); var programInfoCustomPages = customPages.Where(x => x.FirmaMenuItemID == FirmaMenuItem.ProgramInfo.FirmaMenuItemID); var resultsCustomPages = customPages.Where(x => x.FirmaMenuItemID == FirmaMenuItem.Results.FirmaMenuItemID); var helpCustomPages = customPages.Where(x => x.FirmaMenuItemID == FirmaMenuItem.Help.FirmaMenuItemID); var menuItemToSortableList = new Dictionary <FirmaMenuItem, List <IHaveASortOrder> > { { FirmaMenuItem.About, new List <IHaveASortOrder>(aboutCustomPages) }, { FirmaMenuItem.Projects, new List <IHaveASortOrder>(projectsCustomPages) }, { FirmaMenuItem.ProgramInfo, new List <IHaveASortOrder>(programInfoCustomPages) }, { FirmaMenuItem.Results, new List <IHaveASortOrder>(resultsCustomPages) }, { FirmaMenuItem.Help, new List <IHaveASortOrder>(helpCustomPages) } }; EditSortOrderInMenuGroupViewData viewData = new EditSortOrderInMenuGroupViewData(menuItemToSortableList, "Custom Pages"); return(RazorPartialView <EditSortOrderInMenuGroup, EditSortOrderInMenuGroupViewData, EditSortOrderInMenuGroupViewModel>(viewData, viewModel)); }