public async Task Post_BackToOverviewFalse_RedirectsToStateOfExport() { var model = new SpecialHandlingViewModel(); var result = await specialHandlingController.Index(model, false) as RedirectToRouteResult; RouteAssert.RoutesTo(result.RouteValues, "Index", "StateOfExport"); }
public async Task<ActionResult> Index(SpecialHandlingViewModel model, bool? backToOverview = null) { if (!ModelState.IsValid) { return View(model); } try { await mediator.SendAsync(new SetSpecialHandling(model.NotificationId, model.HasSpecialHandlingRequirements.GetValueOrDefault(), model.SpecialHandlingDetails)); if (backToOverview.GetValueOrDefault()) { return RedirectToAction("Index", "Home", new { id = model.NotificationId }); } return RedirectToAction("Index", "StateOfExport", new { id = model.NotificationId }); } catch (ApiBadRequestException ex) { this.HandleBadRequest(ex); if (ModelState.IsValid) { throw; } } return View(model); }
public async Task Post_BackToOverviewTrue_RedirectsToOverview() { var model = new SpecialHandlingViewModel(); var result = await specialHandlingController.Index(model, true) as RedirectToRouteResult; RouteAssert.RoutesTo(result.RouteValues, "Index", "Home"); }
protected void MergeSpecialHandlingDataToDocument(SpecialHandlingViewModel specialHandling, PropertyInfo[] properties) { foreach (var field in CorrespondingMergeFields) { MergeFieldDataMapper.BindCorrespondingField(field, specialHandling, properties); } foreach (var annexField in AnnexMergeFields) { MergeFieldDataMapper.BindCorrespondingField(annexField, specialHandling, properties); } }
public async Task<ActionResult> Index(Guid id, bool? backToOverview = null) { var model = new SpecialHandlingViewModel { NotificationId = id }; var specialHandlingData = await mediator.SendAsync(new GetSpecialHandingForNotification(id)); if (specialHandlingData.HasSpecialHandlingRequirements.HasValue) { model.HasSpecialHandlingRequirements = specialHandlingData.HasSpecialHandlingRequirements; model.SpecialHandlingDetails = specialHandlingData.SpecialHandlingDetails; } return View(model); }
public virtual void GenerateAnnex(int annexNumber) { if (!HasAnnex) { ClearAllFields(); return; } var properties = PropertyHelper.GetPropertiesForViewModel(typeof(SpecialHandlingViewModel)); MergeSpecialHandlingDataToDocument(SpecialHandlingViewModel.GetSpecialHandlingAnnexNotice(data, annexNumber), properties); MergeAnnexNumber(annexNumber); TocText = "Annex " + annexNumber + " - Special handling requirements"; }
public async Task <ActionResult> Index(Guid id, bool?backToOverview = null) { var model = new SpecialHandlingViewModel { NotificationId = id }; var specialHandlingData = await mediator.SendAsync(new GetSpecialHandingForNotification(id)); if (specialHandlingData.HasSpecialHandlingRequirements.HasValue) { model.HasSpecialHandlingRequirements = specialHandlingData.HasSpecialHandlingRequirements; model.SpecialHandlingDetails = specialHandlingData.SpecialHandlingDetails; } return(View(model)); }
public async Task <ActionResult> Index(SpecialHandlingViewModel model, bool?backToOverview = null) { if (!ModelState.IsValid) { return(View(model)); } try { var specialHandlingData = await mediator.SendAsync(new GetSpecialHandingForNotification(model.NotificationId)); await mediator.SendAsync(new SetSpecialHandling(model.NotificationId, model.HasSpecialHandlingRequirements.GetValueOrDefault(), model.SpecialHandlingDetails)); await this.auditService.AddAuditEntry(this.mediator, model.NotificationId, User.GetUserId(), specialHandlingData.HasSpecialHandlingRequirements == null?NotificationAuditType.Added : NotificationAuditType.Updated, NotificationAuditScreenType.SpecialHandling); if (backToOverview.GetValueOrDefault()) { return(RedirectToAction("Index", "Home", new { id = model.NotificationId })); } return(RedirectToAction("Index", "StateOfExport", new { id = model.NotificationId })); } catch (ApiBadRequestException ex) { this.HandleBadRequest(ex); if (ModelState.IsValid) { throw; } } return(View(model)); }
public SpecialHandlingBlock(IList <MergeField> mergeFields, NotificationApplication notification) { data = new SpecialHandlingViewModel(notification); CorrespondingMergeFields = MergeFieldLocator.GetCorrespondingFieldsForBlock(mergeFields, TypeName); AnnexMergeFields = MergeFieldLocator.GetAnnexMergeFields(mergeFields, SpecialHandling); }
public SpecialHandlingBlock(IList<MergeField> mergeFields, NotificationApplication notification) { data = new SpecialHandlingViewModel(notification); CorrespondingMergeFields = MergeFieldLocator.GetCorrespondingFieldsForBlock(mergeFields, TypeName); AnnexMergeFields = MergeFieldLocator.GetAnnexMergeFields(mergeFields, SpecialHandling); }