private async Task <Tickets> GetMyTicketData(SqlDataReader reader, Guid CtryID, Guid DepTID) { Tickets t = new Tickets(); DepartureTimes depTimesX = new DepartureTimes(); Countries ctryX = new Countries(); try { while (await reader.ReadAsync()) { ctryX = await _countriesRepository.GetCountryByIdAsync(CtryID); depTimesX = await _departureTRepository.GetDepartureTimeByID(DepTID); t.ID = (Guid)reader["ID"]; t.Available = (int)reader["Available"]; t.Price = !Convert.IsDBNull(reader["Price"]) ? (int)reader["Price"] : 0; Countries ctry = await _countriesRepository.GetCountryByIdAsync((Guid)reader["CountryID"]); t.Country = ctry.CountryName; t.Departure = depTimesX.Time; t.Destination = ctryX.CountryName; } } catch (Exception ex) { throw ex; } finally { reader.Close(); } return(t); }
public async Task <Countries> GetCountryByIdAsync(Guid id) { return(await _countriesRepository.GetCountryByIdAsync(id)); }