public ClientCompanyProfileViewModel GetClientCompanyProfile(string clientCompanyId) { var company = _clientCompanyManagement.FindById(clientCompanyId); var viewModel = new ClientCompanyProfileViewModel(company); if (company != null) { viewModel.Address = _addressManager.GetAddressViewModel<AddressViewModel>(company.Profile.Address); viewModel.MailingAddress = _addressManager.GetAddressViewModel<AddressViewModel>(company.Profile.MailingAddress); } return viewModel; }
public ActionResult IndexPost(ClientCompanyProfileViewModel viewModel) { var companyId = PluginResults.Find<UserAccessPluginResult>().CompnayId; if (ModelState.IsValid && (viewModel.IsLender || viewModel.IsAppraiserManagementCompany || viewModel.IsBroker || viewModel.IsOtherBusinessType)) { companyId = _companyProfileService.SaveClientCompanyProfile(viewModel, companyId); CommitProviderInstance.Commit(); return PluginResults.Plugins<CurrentMenuPluginResule>().GetRedirectToTab(new { companyId }); } return View(); }
public string SaveClientCompanyProfile(ClientCompanyProfileViewModel viewModel, string clientCompanyId) { var company = _clientCompanyManagement.FindById(viewModel.CompanyId); if (company != null) { viewModel.FillModel(company); _addressManager.FillAddress(company.Profile.Address, viewModel.Address); _addressManager.FillAddress(company.Profile.MailingAddress, viewModel.MailingAddress); } else { var newCompany = new ClientCompany { CompanyId = _clientCompanyIdentityGenerator.Generate(), Status = ClientCompanyStatus.Active, Settings = new ClientCompanySettings() { AppraiserLicenseRequirementsId = 1 /* No Preference */ } }; viewModel.FillModel(newCompany); _addressManager.FillAddress(newCompany.Profile.Address, viewModel.Address); _addressManager.FillAddress(newCompany.Profile.MailingAddress, viewModel.MailingAddress); _clientCompanyManagement.CreateClientCompany(newCompany); clientCompanyId = newCompany.CompanyId; } return clientCompanyId; }