示例#1
0
        public async Task <ActionResult> OtherWasteAdditionalInformation(OtherWasteAdditionalInformationViewModel model, bool?backToOverview = null)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var existingWasteTypeData = await mediator.SendAsync(new GetWasteType(model.NotificationId));

            await mediator.SendAsync(new SetOtherWasteAdditionalInformation(model.NotificationId, model.Description, model.HasAttachement));

            await this.auditService.AddAuditEntry(this.mediator,
                                                  model.NotificationId,
                                                  User.GetUserId(),
                                                  existingWasteTypeData == null?NotificationAuditType.Added : NotificationAuditType.Updated,
                                                  NotificationAuditScreenType.ChemicalComposition);

            if (backToOverview.GetValueOrDefault())
            {
                return(RedirectToAction("Index", "Home", new { id = model.NotificationId }));
            }
            else
            {
                return(RedirectToAction("Index", "WasteGenerationProcess", new { id = model.NotificationId }));
            }
        }
        public async Task OtherWasteAdditionalInformation_Post_BackToOverviewTrue_RedirectsToOverview()
        {
            var model  = new OtherWasteAdditionalInformationViewModel();
            var result = await chemicalCompositionController.OtherWasteAdditionalInformation(model, true) as RedirectToRouteResult;

            RouteAssert.RoutesTo(result.RouteValues, "Index", "Home");
        }
        public async Task OtherWasteAdditionalInformation_Post_BackToOverviewFalse_RedirectsToWasteGenerationProcess()
        {
            var model  = new OtherWasteAdditionalInformationViewModel();
            var result = await chemicalCompositionController.OtherWasteAdditionalInformation(model, false) as RedirectToRouteResult;

            RouteAssert.RoutesTo(result.RouteValues, "Index", "WasteGenerationProcess");
        }
示例#4
0
        public async Task <ActionResult> OtherWasteAdditionalInformation(Guid id, bool?backToOverview = null)
        {
            var model = new OtherWasteAdditionalInformationViewModel
            {
                NotificationId = id
            };

            var wasteTypeData = await mediator.SendAsync(new GetWasteType(id));

            if (wasteTypeData != null)
            {
                model.Description    = wasteTypeData.OtherWasteTypeDescription;
                model.HasAttachement = wasteTypeData.HasAnnex;
            }

            return(View(model));
        }
 public async Task OtherWasteAdditionalInformation_Post_BackToOverviewFalse_RedirectsToWasteGenerationProcess()
 {
     var model = new OtherWasteAdditionalInformationViewModel();
     var result = await chemicalCompositionController.OtherWasteAdditionalInformation(model, false) as RedirectToRouteResult;
     RouteAssert.RoutesTo(result.RouteValues, "Index", "WasteGenerationProcess");
 }
 public async Task OtherWasteAdditionalInformation_Post_BackToOverviewTrue_RedirectsToOverview()
 {
     var model = new OtherWasteAdditionalInformationViewModel();
     var result = await chemicalCompositionController.OtherWasteAdditionalInformation(model, true) as RedirectToRouteResult;
     RouteAssert.RoutesTo(result.RouteValues, "Index", "Home");
 }