public async Task Invalid_TechnologyEmployed_Returns_Same_View()
        {
            var model = new TechnologyEmployedViewModel();
            wasteOperationsController.ModelState.AddModelError("Test", "Error");

            var result = await wasteOperationsController.TechnologyEmployed(model) as ViewResult;
            Assert.Equal(string.Empty, result.ViewName);
        }
        public void CanNotProvideFurtherDetails_WhenAnnexProvided()
        {
            var viewModel = new TechnologyEmployedViewModel
            {
                Details        = invalidTechnologyEmployed,
                AnnexProvided  = true,
                FurtherDetails = "any value"
            };

            Assert.True(ViewModelValidator.ValidateViewModel(viewModel).Count > 0);
        }
        public async Task <ActionResult> TechnologyEmployed(TechnologyEmployedViewModel model, bool?backToOverview = null)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var existingTechnologyEmployedData =
                await mediator.SendAsync(new GetTechnologyEmployed(model.NotificationId));

            await
            mediator.SendAsync(new SetTechnologyEmployed(model.NotificationId, model.AnnexProvided, model.Details, model.FurtherDetails));

            await this.auditService.AddAuditEntry(mediator,
                                                  model.NotificationId,
                                                  User.GetUserId(),
                                                  existingTechnologyEmployedData.HasTechnologyEmployed?NotificationAuditType.Updated : NotificationAuditType.Added,
                                                  NotificationAuditScreenType.TechnologyEmployed);

            return(backToOverview.GetValueOrDefault() ?
                   RedirectToAction("Index", "Home")
                : RedirectToAction("Index", "ReasonForExport"));
        }
        public async Task<ActionResult> TechnologyEmployed(TechnologyEmployedViewModel model, bool? backToOverview = null)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            await
                mediator.SendAsync(new SetTechnologyEmployed(model.NotificationId, model.AnnexProvided, model.Details, model.FurtherDetails));

            return backToOverview.GetValueOrDefault() ? 
                RedirectToAction("Index", "Home")
                : RedirectToAction("Index", "ReasonForExport");
        }