public async Task <ActionResult> Index(Guid id, StateOfExportViewModel model, string submit, bool?backToOverview = null) { await GetCompetentAuthoritiesAndEntryPoints(mediator, model); if (!ModelState.IsValid) { return(View(model)); } return(await SubmitAction(id, model, mediator, backToOverview)); }
public async Task<ActionResult> GetAuthoritiesAndExitPoints(Guid countryId) { var data = await mediator.SendAsync(new GetCompetentAuthoritiesAndEntryOrExitPointsByCountryId(countryId)); var model = new StateOfExportViewModel { CompetentAuthorities = data.CompetentAuthorities, ExitPoints = data.EntryOrExitPoints }; return PartialView("_CompetentAuthoritiesAndExitPoints", model); }
public async Task <ActionResult> GetAuthoritiesAndExitPoints(Guid countryId) { var data = await mediator.SendAsync(new GetCompetentAuthoritiesAndEntryOrExitPointsByCountryId(countryId)); var model = new StateOfExportViewModel { CompetentAuthorities = data.CompetentAuthorities, ExitPoints = data.EntryOrExitPoints }; return(PartialView("_CompetentAuthoritiesAndExitPoints", model)); }
private async Task GetCompetentAuthoritiesAndEntryPoints(IMediator mediator, StateOfExportViewModel model) { if (!model.CountryId.HasValue) { return; } var entryPointsAndCompetentAuthorities = await mediator.SendAsync(new GetCompetentAuthoritiesAndEntryOrExitPointsByCountryId(model.CountryId.Value)); model.ExitPoints = new SelectList(entryPointsAndCompetentAuthorities.EntryOrExitPoints, "Id", "Name"); }
public async Task<ActionResult> Index(Guid id, StateOfExportViewModel model) { if (!ModelState.IsValid) { return View(model); } var stateOfExport = new StateOfExport(id) { CompetentAuthorityId = model.CompetentAuthorityId, CountryId = model.CountryId, ExitPointId = model.ExitPointId }; await mediator.SendAsync(new SetDraftData<StateOfExport>(id, stateOfExport)); return RedirectToAction("Index", "StateOfImport"); }
public async Task <ActionResult> Index(Guid id, StateOfExportViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var stateOfExport = new StateOfExport(id) { CompetentAuthorityId = model.CompetentAuthorityId, CountryId = model.CountryId, ExitPointId = model.ExitPointId }; await mediator.SendAsync(new SetDraftData <StateOfExport>(id, stateOfExport)); return(RedirectToAction("Index", "StateOfImport")); }
private async Task <ActionResult> SubmitAction(Guid id, StateOfExportViewModel model, IMediator mediator, bool?backToOverview) { var stateOfExportSetData = await mediator.SendAsync(new GetStateOfExportWithTransportRouteDataByNotificationId(id)); await mediator.SendAsync(new SetStateOfExportForNotification(id, model.EntryOrExitPointId.Value)); await this.auditService.AddAuditEntry(this.mediator, id, User.GetUserId(), stateOfExportSetData.StateOfExport.ExitPoint == null?NotificationAuditType.Added : NotificationAuditType.Updated, NotificationAuditScreenType.ExportRoute); if (backToOverview.GetValueOrDefault()) { return(RedirectToAction("Index", "Home", new { id })); } return(RedirectToAction("Index", "StateOfImport", new { id })); }
public async Task<ActionResult> Index(Guid id) { var stateOfExport = await mediator.SendAsync(new GetDraftData<StateOfExport>(id)); var model = new StateOfExportViewModel(stateOfExport); model.Countries = await mediator.SendAsync(new GetCountries()); if (model.IsCountrySelected) { var data = await mediator.SendAsync( new GetCompetentAuthoritiesAndEntryOrExitPointsByCountryId(model.CountryId.Value)); model.CompetentAuthorities = data.CompetentAuthorities; model.ExitPoints = data.EntryOrExitPoints; } return View(model); }
public async Task <ActionResult> Index(Guid id) { var stateOfExport = await mediator.SendAsync(new GetDraftData <StateOfExport>(id)); var model = new StateOfExportViewModel(stateOfExport); model.Countries = await mediator.SendAsync(new GetCountries()); if (model.IsCountrySelected) { var data = await mediator.SendAsync( new GetCompetentAuthoritiesAndEntryOrExitPointsByCountryId(model.CountryId.Value)); model.CompetentAuthorities = data.CompetentAuthorities; model.ExitPoints = data.EntryOrExitPoints; } return(View(model)); }