Exemplo n.º 1
0
        public void ViewModel_Can_Have_Framework_If_Transfer_Funding()
        {
            _validViewModel.IsTransferFunded = "on";

            var result = _validator.ValidateAdd(_validViewModel);

            result.Count().Should().Be(0);
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Save(AddEditApprenticeshipsViewModel vm, string hashedAccountId, string estimationName)
        {
            var viewModel = await _addApprenticeshipOrchestrator.UpdateAddApprenticeship(vm);

            var result = _validator.ValidateAdd(vm);

            foreach (var r in result)
            {
                ModelState.AddModelError(r.Key, r.Value);
            }


            if (!ModelState.IsValid)
            {
                viewModel.Courses = _addApprenticeshipOrchestrator.GetApprenticeshipAddSetup(false).Courses;

                return(View("AddApprenticeships", viewModel));
            }

            await _addApprenticeshipOrchestrator.StoreApprenticeship(viewModel, hashedAccountId, estimationName);

            return(RedirectToAction(nameof(CostEstimation), new { hashedaccountId = hashedAccountId, estimateName = estimationName }));
        }