public async Task <IActionResult> Date(CertificateDateViewModel vm) { var result = _validator.Validate(vm); var actionResult = await SaveViewModel(vm, returnToIfModelNotValid : "~/Views/CertificateAmend/Date.cshtml", nextAction : RedirectToAction("Check", "CertificateAmend", new { certificateId = vm.Id }), action : CertificateActions.Date); return(actionResult); }
private CertificateDateViewModel SetupViewModel() { var viewModel = new CertificateDateViewModel(); viewModel.FromCertificate(Certificate); viewModel.Day = DateTime.Now.Day.ToString(); viewModel.Month = DateTime.Now.Month.ToString(); viewModel.Year = DateTime.Now.Year.ToString(); return(viewModel); }
public void Arrange() { var certificateDateViewModelValidator = new CertificateDateViewModelValidator(); var certificateApprenticeDetailsController = new CertificateDateController(MockedLogger.Object, MockHttpContextAccessor.Object, ApiClient, certificateDateViewModelValidator); _result = certificateApprenticeDetailsController.Date(Certificate.Id).GetAwaiter().GetResult(); var result = _result as ViewResult; _viewModelResponse = result.Model as CertificateDateViewModel; }
public async Task <IActionResult> Date(CertificateDateViewModel vm) { var result = _validator.Validate(vm); if (!result.IsValid && result.Errors.Any(e => e.Severity == Severity.Warning)) { vm.WarningShown = "true"; return(View("~/Views/Certificate/Date.cshtml", vm)); } var nextAction = vm.SelectedGrade == CertificateGrade.Fail ? RedirectToAction("Check", "CertificateCheck") : RedirectToAction("Address", "CertificateAddress"); var actionResult = await SaveViewModel(vm, returnToIfModelNotValid : "~/Views/Certificate/Date.cshtml", nextAction : nextAction, action : CertificateActions.Date); return(actionResult); }