/// <summary> /// Present landing or departure by airline name /// </summary> /// what return? public IList <SearchView> SearchByParams(SearchQueryParams searchParams) { if (searchParams != null) { //if (searchParams.FlightType == null) if (string.IsNullOrEmpty(searchParams.FlightType)) { searchParams.FlightType = ""; } if (!string.IsNullOrEmpty(searchParams.AirlineName)) { return(_flightDAO.SearchFlightsByAirlineName(searchParams.AirlineName, searchParams.FlightType)); } if (searchParams.FlightNumber > 0) { return(_flightDAO.SearchFlightsByFlightNum(searchParams.FlightNumber, searchParams.FlightType)); } if (!string.IsNullOrEmpty(searchParams.DesCountry)) { return(_flightDAO.SearchFlightsByDesCountry(searchParams.DesCountry, searchParams.FlightType)); } if (!string.IsNullOrEmpty(searchParams.OriCountry)) { return(_flightDAO.SearchFlightsByOriCountry(searchParams.OriCountry, searchParams.FlightType)); } } return(null); }
public async Task <BusinessItem> GetById(int id) { var searchParams = new SearchQueryParams() { EventId = id, StartDate = DateTime.MinValue }; var eventItem = (await _calendarService.Get(searchParams)).FirstOrDefault(); if (eventItem == null) { return(null); } var item = new BusinessItem() { Id = eventItem.Id, Category = eventItem.Category, Type = eventItem.Type, StartDate = eventItem.StartDate, StartTime = eventItem.StartTime, EndDate = eventItem.EndDate, Description = eventItem.Description }; foreach (var eventItemMember in eventItem.Members) { var member = await _memberService.Get(eventItemMember.Id); item.Members.Add(member); } return(item); }
public IHttpActionResult SearchByParams([FromBody] SearchQueryParams searchParams) { IList <SearchView> searchList = _anonymous.SearchByParams(searchParams); if (searchList.Count == 0) { return(NotFound()); } return(Ok(searchList)); }
public async Task <IList <BusinessItem> > Get(SearchQueryParams searchParams) { var events = await _calendarService.Get(searchParams); var items = events.Where(evt => evt.Type.ToLower() == "main chamber").Select(evt => new BusinessItem() { Id = evt.Id, Category = evt.Category, Type = evt.Type, StartDate = evt.StartDate, StartTime = evt.StartTime, EndDate = evt.EndDate, Description = evt.Description, }).OrderBy(evt => evt.StartDate).ToArray(); return(items); }
public async Task <List <Event> > Get(SearchQueryParams searchParams) { var request = new HttpRequestMessage(HttpMethod.Get, BuildUrl(searchParams)); var client = _clientFactory.CreateClient(); var response = await client.SendAsync(request); if (response.IsSuccessStatusCode) { var data = await response.Content.ReadAsStringAsync(); return(JsonConvert.DeserializeObject <List <Event> >(data)); } else { throw new Exception("Error"); } }
private string BuildUrl(SearchQueryParams searchParams) { var query = new StringBuilder($"{CalendarUrl}?"); query.Append($"queryParameters.startDate={searchParams.StartDate.ToString("yyyy-MM-dd", CultureInfo.CurrentUICulture)}"); if (searchParams.EndDate.HasValue) { query.Append($"&queryParameters.endDate={searchParams.EndDate.Value.ToString("yyyy-MM-dd", CultureInfo.CurrentUICulture)}"); } query.Append($"&queryParameters.house=Commons"); if (searchParams.EventId.HasValue) { query.Append($"&queryParameters.eventId={searchParams.EventId}"); } return(query.ToString()); }
public async Task <IActionResult> Get([FromQuery] SearchQueryParams searchQueryParams) { var items = await _businessService.Get(searchQueryParams); return(Ok(items)); }