public List <Movement> GetMovementsWithName(Movement movement) { SQLiteDatabaseContext context = new SQLiteDatabaseContext(); var movements = context.MovementModels.Where(m => m.Name == movement.Name).ToList(); return(movements); }
internal void AddMovement(Movement movement) { SQLiteDatabaseContext context = new SQLiteDatabaseContext(); context.MovementModels.Add(movement); context.SaveChanges(); }
public List <Movement> GetFirstFiveMovements() { SQLiteDatabaseContext context = new SQLiteDatabaseContext(); var movements = context.MovementModels.SqlQuery("SELECT * FROM movements LIMIT 5"); return(movements.ToList()); }
public void InitDatabase(IConfiguration configuration) { if (CreateDatabaseIfNotExists(configuration)) { return; } SQLiteDatabaseContext context = new SQLiteDatabaseContext(); var exercisesString = File.ReadAllLines(configuration.GetSection("AppSettings").GetSection("MovementFile").Value); List <Movement> movements = new List <Movement>(); for (int i = 0; i < exercisesString.Length; i++) { var splitMovementString = exercisesString[i].Split(","); movements.Add(new Movement(splitMovementString[0].Trim(), splitMovementString[1].Trim())); } context.MovementModels.AddRange(movements); context.SaveChanges(); }