public async Task <InsuranceCompanyViewModel> InsuranceCompany() { InsuranceCompanyViewModel viewModel = new InsuranceCompanyViewModel(); viewModel.ListModel = await this.genericService.InsuranceCompany().GetAll(); return(viewModel); }
public async Task <ActionResult> ManageCompany(InsuranceCompanyViewModel company) { // Check Model. if (ModelState.IsValid) { company = Mapper.Map <InsuranceCompanyViewModel>(Factory.Save(company as IInsuranceCompanyDto)); SelectListItemCache.ClearCache(SelectListItemCacheType.InsuranceCompany); } await LoadSelections(company); return(PartialView("_InsuranceCompanyManage", company)); }
private async Task LoadSelections(InsuranceCompanyViewModel company) { company.CccInsuranceCompanies = (await Factory.GetAllAsync <ICCCInsuranceCompanyDto>()).Select(x => new SelectListItem { Disabled = x.RepairInsuranceCompanyId != null && x.RepairInsuranceCompanyId != company.InsuranceCompanyId, Value = x.CCCInsuranceCompanyId, Text = $@"{x.CCCInsuranceCompanyName} ({x.CCCInsuranceCompanyId?.Trim()})" }).OrderBy(o => o.Text); }