private async Task <SelectItineraryRequestsModel> BuildSelectItineraryRequestsModel(int itineraryId, RequestSearchCriteria criteria) { var model = new SelectItineraryRequestsModel(); var itinerary = await _mediator.SendAsync(new ItineraryDetailQuery { ItineraryId = itineraryId }); model.CampaignId = itinerary.CampaignId; model.CampaignName = itinerary.CampaignName; model.EventId = itinerary.EventId; model.EventName = itinerary.EventName; model.ItineraryName = itinerary.Name; criteria.EventId = itinerary.EventId; var requests = await _mediator.SendAsync(new RequestListItemsQuery { Criteria = criteria }); foreach (var request in requests) { var selectItem = new RequestSelectModel { Id = request.Id, Name = request.Name, DateAdded = request.DateAdded, City = request.City, Address = request.Address, Postcode = request.Postcode }; model.Requests.Add(selectItem); } return(model); }
public async Task <IActionResult> SelectRequests(int id) { var orgId = await _mediator.SendAsync(new OrganizationIdQuery { ItineraryId = id }); if (orgId == 0 || !User.IsOrganizationAdmin(orgId)) { return(HttpUnauthorized()); } var model = new SelectItineraryRequestsModel(); var itinerary = await _mediator.SendAsync(new ItineraryDetailQuery { ItineraryId = id }); model.CampaignId = itinerary.CampaignId; model.CampaignName = itinerary.CampaignName; model.EventId = itinerary.EventId; model.EventName = itinerary.EventName; model.ItineraryName = itinerary.Name; var requests = await _mediator.SendAsync(new RequestListItemsQuery { criteria = new RequestSearchCriteria() }); foreach (var request in requests) { var selectItem = new RequestSelectModel { Id = request.Id, Name = request.Name, }; model.Requests.Add(selectItem); } return(View("SelectRequests", model)); }