Beispiel #1
0
        public async Task Post_BackToOverviewFalse_RedirectsToPhysicalCharacteristics()
        {
            var model  = new WasteGenerationProcessViewModel();
            var result = await wasteGenerationProcessController.Index(model, false) as RedirectToRouteResult;

            RouteAssert.RoutesTo(result.RouteValues, "Index", "PhysicalCharacteristics");
        }
Beispiel #2
0
        public async Task Post_BackToOverviewTrue_RedirectsToOverview()
        {
            var model  = new WasteGenerationProcessViewModel();
            var result = await wasteGenerationProcessController.Index(model, true) as RedirectToRouteResult;

            RouteAssert.RoutesTo(result.RouteValues, "Index", "Home");
        }
Beispiel #3
0
        public async Task <ActionResult> Index(Guid id, bool?backToOverview = null)
        {
            var wasteGenerationProcessData =
                await mediator.SendAsync(new GetWasteGenerationProcess(id));

            var model = new WasteGenerationProcessViewModel(wasteGenerationProcessData);

            return(View(model));
        }
Beispiel #4
0
        public async Task <ActionResult> Index(WasteGenerationProcessViewModel model, bool?backToOverview = null)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            try
            {
                var wasteGenerationProcessData = await mediator.SendAsync(new GetWasteGenerationProcess(model.NotificationId));

                await mediator.SendAsync(model.ToRequest());

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

                if (backToOverview.GetValueOrDefault())
                {
                    return(RedirectToAction("Index", "Home", new { id = model.NotificationId }));
                }

                return(RedirectToAction("Index", "PhysicalCharacteristics", new { id = model.NotificationId }));
            }
            catch (ApiBadRequestException ex)
            {
                this.HandleBadRequest(ex);
                if (ModelState.IsValid)
                {
                    throw;
                }
            }
            return(View(model));
        }
 public async Task Post_BackToOverviewFalse_RedirectsToPhysicalCharacteristics()
 {
     var model = new WasteGenerationProcessViewModel();
     var result = await wasteGenerationProcessController.Index(model, false) as RedirectToRouteResult;
     RouteAssert.RoutesTo(result.RouteValues, "Index", "PhysicalCharacteristics");
 }
 public async Task Post_BackToOverviewTrue_RedirectsToOverview()
 {
     var model = new WasteGenerationProcessViewModel();
     var result = await wasteGenerationProcessController.Index(model, true) as RedirectToRouteResult;
     RouteAssert.RoutesTo(result.RouteValues, "Index", "Home");
 }