Exemplo n.º 1
0
 public ActionResult Add()
 {
     try
     {
         CustomerViewModel customerViewModel = new CustomerViewModel();
         var countryGuid = _countryService.GetCountryGuidBy3DigitCode("USA");
         customerViewModel.CountryId                   = countryGuid;
         customerViewModel.AgencySelectListItems       = new Dictionary <string, string>();
         customerViewModel.DepartmentSelectListItems   = _usCustomerOfficeListService.GetUsCustomerOfficeDepartmentList().ToDictionary(x => x.DepartmentName, x => x.DepartmentName);
         customerViewModel.CustomerTypeSelectListItems = _customerTypeService.GetCustomerTypeList().ToDictionary(x => x.CustomerTypeGuid, x => x.CustomerTypeName);
         customerViewModel.CountrySelectListItems      = _countryService.GetCountryList().ToDictionary(x => x.CountryId, x => x.CountryName);
         customerViewModel.StateSelectListItems        = _stateRepository.GetStateByCountryGuid(customerViewModel.CountryId).ToDictionary(x => x.StateId, x => x.StateName);
         return(PartialView(customerViewModel));
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("", ex.Message);
         return(BadRequestFormatter.BadRequest(this, ex));
     }
 }