コード例 #1
0
		public ActionResult Index()
		{
			AppraisalCompanyAddViewModel model = TempData[_invalidModelKey] as AppraisalCompanyAddViewModel;
			if (model == null)
			{
				model = new AppraisalCompanyAddViewModel();
			}
			return View(model);
		}
コード例 #2
0
		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);
		}
コード例 #3
0
		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);
		}
コード例 #4
0
		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;
		}
コード例 #5
0
		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));
		}
コード例 #6
0
		private void SaveCompany(AppraisalCompanyAddViewModel model)
		{
			_appraisalCompanySignUpService.CreateCompanyWithAppraisalCompanyAdminUser(model);
			CommitProviderInstance.Commit();
		}