public ActionResult ApplyAccountNumber(AppraiserUserBankingViewModel bankingViewModel, int? userId = null)
		{
			bool? bankingInfoSaved = null;
			if (ModelState.IsValid)
			{
				_appraiserUserService.SaveAppraiserBanking(bankingViewModel, User.Identity.Name, true);
				CommitProviderInstance.Commit();
				bankingInfoSaved = true;
			}

			return RedirectToStep(NameHelper.AppraiserProfile.Banking, bankingViewModel.EditUserId, bankingViewModel.IsOwnPage, bankingInfoSaved);
		}
		public ActionResult Banking(AppraiserUserBankingViewModel bankingModel, string nextStep, int? userId = null)
		{
			if (bankingModel.EditUserId == 0)
			{
				bankingModel.EditUserId = userId.HasValue ? userId.Value : 0;
			}
			var oldCompanyBanking = _appraiserUserService.GetAppraiserBanking(User.Identity.Name, bankingModel.EditUserId);
			bankingModel.AccountNumber = oldCompanyBanking.AccountNumber;

			_appraiserUserService.SaveAppraiserBanking(bankingModel, User.Identity.Name);
			CommitProviderInstance.Commit();
			return RedirectToStep(nextStep, bankingModel.EditUserId, bankingModel.IsOwnPage);
		}
Beispiel #3
0
		public void SaveAppraiserBanking_should_throw_exception_if_banking_or_loginname_params_are_null()
		{
			var bankingViewModel = new AppraiserUserBankingViewModel() { BankAccount = "Test Bank", BankingInstitution = "Test Institution" };
			Target.Invoking(m => m.SaveAppraiserBanking(null, "test")).ShouldThrow<ArgumentNullException>().And.ParamName.Should().Contain("banking");
			Target.Invoking(m => m.SaveAppraiserBanking(bankingViewModel, null)).ShouldThrow<ArgumentNullException>().And.ParamName.Should().Contain("currentUserEmail");
			Target.Invoking(m => m.SaveAppraiserBanking(bankingViewModel, String.Empty)).ShouldThrow<ArgumentNullException>().And.ParamName.Should().Contain("currentUserEmail");
		}
		private ActionResult GetBankingView(AppraiserUserBankingViewModel bankingViewModel, int? userId)
		{
			ViewBag.Header = bankingViewModel.SectionTitle;
			ViewBag.IsOwnPage = bankingViewModel.IsOwnPage;
			ViewBag.CurrentStep = NameHelper.AppraiserProfile.Banking;
			ViewBag.ControllerName = NameHelper.AppraiserProfile.Controller;
			ViewBag.ApplyAccountNumberActionName = NameHelper.AppraiserWizard.ApplyAccountNumber;
			return View(NameHelper.AppraiserProfile.Banking, GetViewModel(bankingViewModel, userId));
		}
		public void AppraiserWizard_Banking_valid_model_post_without_next_step_should_redirect_to_banking_and_populate_SaveDraft_and_currentModel_to_TempData()
		{
			AppraiserUserService.GetAppraiser(Arg.Any<string>(), Arg.Any<int?>()).Returns(new AppraiserUser());
			AppraiserUserService.GetAppraiserBanking(Arg.Any<string>()).Returns(new AppraiserUserBankingViewModel());
			var model = new AppraiserUserBankingViewModel();
			//act
			var actionResult = Target.Banking(model, null);
			Target.TempData.Should().HaveCount(1);
			Target.TempData["SaveDraft"].Should().Be(true);
			actionResult.Should().NotBeNull().And.BeOfType<RedirectToRouteResult>();
			((RedirectToRouteResult)actionResult).RouteValues.Should().HaveCount(2);
			((RedirectToRouteResult)actionResult).RouteValues["action"].Should().Be("Banking");
		}
		public void AppraiserWizard_Banking_invalid_model_post_should_redirect_to_banking_with_model()
		{
			AppraiserUserService.GetAppraiser(Arg.Any<string>()).Returns(new AppraiserUser());
			AppraiserUserService.GetAppraiserBanking(Arg.Any<string>()).Returns(new AppraiserUserBankingViewModel());
			Target.ModelState.AddModelError("test error", "test error");

			var model = new AppraiserUserBankingViewModel();
			var actionResult = Target.Banking(model, null);
			Target.TempData.Should().HaveCount(1);
			Target.TempData["SaveDraft"].Should().Be(true);
			actionResult.Should().NotBeNull().And.BeOfType<RedirectToRouteResult>();
			((RedirectToRouteResult)actionResult).RouteValues.Should().HaveCount(2);
			((RedirectToRouteResult)actionResult).RouteValues["action"].Should().Be("Banking");
		}
Beispiel #7
0
		private ActionResult GetBankingView(AppraiserUserBankingViewModel model)
		{
			ViewBag.CurrentStep = (int)TabIndex.Banking;
			ViewBag.ControllerName = NameHelper.AppraiserWizard.Controller;
			ViewBag.ApplyAccountNumberActionName = NameHelper.AppraiserWizard.ApplyAccountNumber;
			return View(NameHelper.AppraiserWizard.Banking, GetWrappedViewModel(model));
		}
Beispiel #8
0
		public ActionResult Banking(AppraiserUserBankingViewModel bankingModel, int? nextStep, bool? isSubmit = null)
		{
			if ((nextStep ?? (int)TabIndex.Banking) <= (int)TabIndex.Banking || ModelState.IsValid)
			{
				var oldCompanyBanking = _appraiserUserService.GetAppraiserBanking(User.Identity.Name);
				bankingModel.AccountNumber = oldCompanyBanking.AccountNumber;

				_appraiserUserService.SaveAppraiserBanking(bankingModel, User.Identity.Name);

				if (isSubmit ?? false)
				{
					TempData["ShowProceedPopup"] = true;
					TempData[_appraiserBankingKey] = bankingModel;

					//Schedule Sending Notification To Registered User					
					_taskManager.ScheduleUserRegisteredNotification(User.Identity.Name, SafeConvert.ToString(false));
				}
				else if (!nextStep.HasValue || nextStep.Value == (int)TabIndex.Banking)
				{
					TempData["SaveDraft"] = true;
				}
				CommitProviderInstance.Commit();
				return RedirectToStep(SafeConvert.ToEnum<TabIndex>(nextStep) ?? TabIndex.Banking);
			}

			TempData[_appraiserBankingKey] = bankingModel;
			return RedirectToStep(TabIndex.Banking);
		}
Beispiel #9
0
		public ActionResult ApplyAccountNumber(AppraiserUserBankingViewModel bankingViewModel)
		{
			bool? bankingInfoSaved = null;
			if (ModelState.IsValid)
			{
				_appraiserUserService.SaveAppraiserBanking(bankingViewModel, User.Identity.Name, true);
				CommitProviderInstance.Commit();
				bankingInfoSaved = true;
			}

			return RedirectToStep(TabIndex.Banking, bankingInfoSaved);
		}