public ActionResult Create() { UserModel model = userService.GetEmptyUserModel(); model.dRoleList = dynamicList.GetRolesSelectList(); model.dDesignationList = dynamicList.GetDesignationList(); model.dOfficeList = dynamicList.GetOfficeList(); return(View(@"~\Views\Setup\User\Create.cshtml", model)); }
public ActionResult Edit(int?id) { try { if (id == null) { return(HttpNotFound()); } var missingModel = missingService.GetOneMissingModel(id); var missingViewModel = new MissingUnApproveViewModel { MissingModel = missingModel, PhotoList = photoService.GetAllT().Where(x => x.MissingId == id) ?? new List <PhotoModel>(), GenderList = StaticSelectList.GenderList(), FiscalYearList = dynamicSelectList.GetFiscalYearList(), OfficeList = dynamicSelectList.GetOfficeList(Convert.ToInt32(missingModel.OfficeId)), ColourList = dynamicSelectList.GetColorList(), EducationList = dynamicSelectList.GetColorList(), ReligionList = dynamicSelectList.GetReligionList(), CountryList = dynamicSelectList.GetCountryList(), StateList = dynamicSelectList.GetStateList(), IdTypeList = dynamicSelectList.GetIdTypeList(), EthnicityList = dynamicSelectList.GetEthnicities(), MartialStatusList = StaticSelectList.MartialList(), PersonTypeList = StaticSelectList.PersonTypeList(), HeightUnitList = StaticSelectList.HeightUnitList(), MDistrictList = dynamicSelectList.GetDistrictListByStateId(missingModel.MStateId), PDistrictList = dynamicSelectList.GetDistrictListByStateId(missingModel.PStateId), TDistrictList = dynamicSelectList.GetDistrictListByStateId(missingModel.TStateId), PMunicipalityList = dynamicSelectList.GetDistrictListByStateId(missingModel.PDistrictId), MMunicipalityList = dynamicSelectList.GetDistrictListByStateId(missingModel.MDistrictId), TMunicipalityList = dynamicSelectList.GetMunicipalityListByDistrictId(missingModel.TDistrictId), }; return(View(missingViewModel)); } catch (DbEntityValidationException e) { TempData["Danger"] = $"Opps something went wrong {string.Join(";",e.EntityValidationErrors.SelectMany(x=>x.ValidationErrors).Select(x=>x.ErrorMessage))}"; throw; } }