public ActionResult Edit(int id) { SRStatusViewModel model = null; using (SrStatusFacade facade = new SrStatusFacade()) { var st = facade.GetSrStatus(id).FirstOrDefault(); model = loadDataToViewModel(st); } return(Edit(model)); }
private void initList(byte type = 0) { using (SrStatusFacade statfacade = new SrStatusFacade()) { ViewBag.SRStateList = statfacade.GetSrState() .OrderBy(x => x.SRStateId) .Select(x => new SelectListItem() { Value = x.SRStateId.ToString(), Text = x.SRStateName }); using (SrPageFacade pageFacade = new SrPageFacade()) { ViewBag.SRPageList = pageFacade.GetSrPages() .OrderBy(x => x.SrPageName) .Select(x => new SelectListItem() { Value = x.SrPageId.ToString(), Text = x.SrPageName }); } switch (type) { case 1: { //Create Page } break; default: { //Search Page ViewBag.SRStatusList = statfacade.GetSrStatus() .OrderBy(x => x.SRStatusName) .Select(x => new SelectListItem() { Value = x.SRStatusId.ToString(), Text = x.SRStatusName }); } break; } } }