internal void AddMovement(Movement movement) { SQLiteDatabaseContext context = new SQLiteDatabaseContext(); context.MovementModels.Add(movement); context.SaveChanges(); }
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(); }