private async Task <ActionResult> SubmitAction(Guid id, Guid?transitStateId, TransitStateViewModel model, bool?backToOverview) { try { TransitStateWithTransportRouteData existingData = await mediator.SendAsync(new GetTransitStateWithTransportRouteDataByNotificationId(id, transitStateId)); var request = new SetTransitStateForNotification(id, model.CountryId.Value, model.EntryPointId.Value, model.ExitPointId.Value, model.CompetentAuthorities.SelectedValue, transitStateId, model.OrdinalPosition); await mediator.SendAsync(request); await this.auditService.AddAuditEntry(this.mediator, id, User.GetUserId(), existingData.TransitState == null?NotificationAuditType.Added : NotificationAuditType.Updated, NotificationAuditScreenType.Transits); return(RedirectToAction("Summary", "TransportRoute", new { id, backToOverview })); } catch (ApiException) { ModelState.AddModelError(string.Empty, "Error saving this record. You may already have saved this record, return to the summary to edit this record."); } return(View(model)); }
private async Task<ActionResult> SubmitAction(Guid id, Guid? transitStateId, TransitStateViewModel model, bool? backToOverview) { try { var request = new SetTransitStateForNotification(id, model.CountryId.Value, model.EntryPointId.Value, model.ExitPointId.Value, model.CompetentAuthorities.SelectedValue, transitStateId, model.OrdinalPosition); await mediator.SendAsync(request); return RedirectToAction("Summary", "TransportRoute", new { id, backToOverview }); } catch (ApiException) { ModelState.AddModelError(string.Empty, "Error saving this record. You may already have saved this record, return to the summary to edit this record."); } return View(model); }