private static DataContracts.Meal.Meal GetMeal(MealOrdinals ordinals, SqliteDataReader query) { return(new DataContracts.Meal.Meal { Id = query.GetInt32(ordinals.Id), Name = query.GetString(ordinals.Name), IsBreakfast = query.GetBoolean(ordinals.IsBreakfast), IsLunch = query.GetBoolean(ordinals.IsLunch), IsDinner = query.GetBoolean(ordinals.IsDinner), IsSnack = query.GetBoolean(ordinals.IsSnack) }); }
public List <DataContracts.Meal.Meal> Get() { var result = new List <DataContracts.Meal.Meal>(); using (var connection = GetConnection()) { connection.Open(); var command = GetCommand(LiteQueries.Get, connection); var query = command.ExecuteReader(); var ordinals = new MealOrdinals(query); while (query.Read()) { result.Add(GetMeal(ordinals, query)); } connection.Close(); } return(result); }