public MuscleGroup DeleteMuscle(int muscleGroupID) { MuscleGroup dbEntry = context.MuscleGroup .FirstOrDefault(p => p.muscleGroupID == muscleGroupID); if (dbEntry != null) { context.MuscleGroup.Remove(dbEntry); context.SaveChanges(); } return(dbEntry); }
public static void EnsurePopulated(IApplicationBuilder app) { AppMuscleDbContext context = app.ApplicationServices .GetRequiredService <AppMuscleDbContext>(); context.Database.Migrate(); if (!context.MuscleGroup.Any()) { context.MuscleGroup.AddRange(); context.SaveChanges(); } }