public ActionResult Index() { AppraisalCompanyAddViewModel model = TempData[_invalidModelKey] as AppraisalCompanyAddViewModel; if (model == null) { model = new AppraisalCompanyAddViewModel(); } return View(model); }
public void CreateCompanyWithAppraisalCompanyAdminUser(AppraisalCompanyAddViewModel viewModel) { AppraisalCompanySignUpViewModel signUpViewModel = new AppraisalCompanySignUpViewModel { AppraisalCompanyAdmin = viewModel.AppraisalCompanyAdmin, CompanyName = viewModel.CompanyName, LocationState = viewModel.PhysicalAddress.State.Substring(0, 2), CompanyType = viewModel.CompanyType }; CreateCompanyWithAppraisalCompanyAdminUser(signUpViewModel, viewModel.PhysicalAddress); }
public ActionResult SaveAppraisalCompany(AppraisalCompanyAddViewModel model, bool toRedirect = false) { if (!CheckValidity(model)) { TempData[_invalidModelKey] = model; return RedirectToAction(NameHelper.AppraisalCompanyAdd.Index); } SaveCompany(model); _taskManager.ScheduleManuallyRegisteredUserNotification(model.AppraisalCompanyAdmin.Email, model.AppraisalCompanyAdmin.Password); if (toRedirect) { return RedirectToAction(NameHelper.AppraisalCompaniesPipeline.Companies, NameHelper.AppraisalCompaniesPipeline.Controller); } return RedirectToAction(NameHelper.AppraisalCompanyAdd.Index); }
private bool CheckValidity(AppraisalCompanyAddViewModel model) { var validateAddress = new ValidateAddressArg { City = model.PhysicalAddress.City, State = model.PhysicalAddress.State, Street = model.PhysicalAddress.Street, ZIP = model.PhysicalAddress.ZIP }; var geocodingValidationResult = _geocodingValidation.ValidateAddress(validateAddress); if (!geocodingValidationResult.IsValid) { model.AddressValidationFailedMessage = Constants.ErrorMessages.GeocodingVerificationError; } return geocodingValidationResult.IsValid && ModelState.IsValid; }
public void CreateCompanyWithAppraisalCompanyAdminUser_should_create_AppraisalCompanyAdmin_from_AppraisalCompanyAddViewModel() { var model = new AppraisalCompanyAddViewModel() { AppraisalCompanyAdmin = new DVS.Logic.ViewModels.UserViewModel() { FirstName = "first", LastName = "last", Email = "*****@*****.**" }, CompanyName = "name", PhysicalAddress = new DVS.Logic.ViewModels.AddressViewModel() { City = "city", State = "CA, California", Street = "street", ZIP = "00000" } }; AppraisalCompanySignUpViewModel appraisalCompanySignUpViewModel = new AppraisalCompanySignUpViewModel() { LocationState = "CA, California" }; AppraisalCompanyDetail companyDetails = new AppraisalCompanyDetail(); AppraisalCompanyManagement.CreateAppraisalCompany(Arg.Any<AppraisalCompanyProfileViewModel>()).Returns(companyDetails); //act Target.CreateCompanyWithAppraisalCompanyAdminUser(model); AppraiserManagement.Received().CreateUser(Arg.Is<AppraiserUser>(aca => aca.Status == AppraiserUserStatus.Applied)); }
private void SaveCompany(AppraisalCompanyAddViewModel model) { _appraisalCompanySignUpService.CreateCompanyWithAppraisalCompanyAdminUser(model); CommitProviderInstance.Commit(); }