private ActionResult GetSoftwareView(AppraiserUserSoftwareViewModel softwareViewModel, int? userId)
		{
			ViewBag.Header = softwareViewModel.SectionTitle;
			ViewBag.IsOwnPage = softwareViewModel.IsOwnPage;
			ViewBag.CurrentStep = NameHelper.AppraiserProfile.Software;
			return View(NameHelper.AppraiserProfile.Software, GetViewModel(softwareViewModel, userId));
		}
		public ActionResult Software(AppraiserUserSoftwareViewModel softwareModel, string nextStep, int? userId = null)
		{
			if (softwareModel.EditUserId == 0)
			{
				softwareModel.EditUserId = userId.HasValue ? userId.Value : 0;
			}
			if (ModelState.IsValid)
			{
				_appraiserUserService.SaveAppraiserSoftware(softwareModel, User.Identity.Name);
				CommitProviderInstance.Commit();
				return RedirectToStep(nextStep, softwareModel.EditUserId, softwareModel.IsOwnPage);
			}

			TempData[_appraiserSoftwareKey] = softwareModel;
			return RedirectToStep(NameHelper.AppraiserProfile.Software, softwareModel.EditUserId, softwareModel.IsOwnPage);
		}
Beispiel #3
0
		public void SaveAppraiserSoftware_should_throw_exception_if_login_or_software_are_null()
		{
			var appraiserSoftwareViewModel = new AppraiserUserSoftwareViewModel();
			//act
			Action act1 = () => Target.SaveAppraiserSoftware(null, "login");
			act1.ShouldThrow<ArgumentNullException>().And.ParamName.Should().Contain("appraiserSoftware");

			Action act2 = () => Target.SaveAppraiserSoftware(appraiserSoftwareViewModel, " ");
			act2.ShouldThrow<ArgumentNullException>().And.ParamName.Should().Contain("email");
		}
		public void AppraiserWizard_Software_valid_model_post_should_redirect_to_software_without_model_and_populate_tempdata_if_nextstep_is_not_specified()
		{
			var model = new AppraiserUserSoftwareViewModel();
			var actionResult = Target.Software(model, null);
			Target.TempData.Should().HaveCount(1);
			Target.TempData["SaveDraft"].Should().Be(true);
			actionResult.Should().NotBeNull().And.BeOfType<RedirectToRouteResult>();
			((RedirectToRouteResult)actionResult).RouteValues.Should().HaveCount(1);
			((RedirectToRouteResult)actionResult).RouteValues["action"].Should().Be("Software");
		}
		public void AppraiserWizard_Software_invalid_model_post_should_redirect_to_software_with_model()
		{
			Target.ModelState.AddModelError("test error", "test error");

			var model = new AppraiserUserSoftwareViewModel();
			var actionResult = Target.Software(model, null);
			Target.TempData.Should().HaveCount(1);
			actionResult.Should().NotBeNull().And.BeOfType<RedirectToRouteResult>();
			((RedirectToRouteResult)actionResult).RouteValues.Should().HaveCount(1);
			((RedirectToRouteResult)actionResult).RouteValues["action"].Should().Be("Software");
		}
Beispiel #6
0
		private ActionResult GetSoftwareView(AppraiserUserSoftwareViewModel model)
		{
			ViewBag.CurrentStep = (int)TabIndex.Software;
			return View(NameHelper.AppraiserWizard.Software, GetWrappedViewModel(model));
		}
Beispiel #7
0
		public ActionResult Software(AppraiserUserSoftwareViewModel softwareModel, int? nextStep)
		{
			if ((nextStep ?? (int)TabIndex.Software) <= (int)TabIndex.Software || ModelState.IsValid)
			{
				_appraiserUserService.SaveAppraiserSoftware(softwareModel, User.Identity.Name);
				SaveLastCompletedStep(TabIndex.Software, nextStep);
				CommitProviderInstance.Commit();
				if (!nextStep.HasValue || nextStep.Value == (int)TabIndex.Software)
				{
					TempData["SaveDraft"] = true;
				}
				return RedirectToStep(SafeConvert.ToEnum<TabIndex>(nextStep) ?? TabIndex.Software);
			}

			TempData[_appraiserSoftwareKey] = softwareModel;
			return RedirectToStep(TabIndex.Software);
		}