예제 #1
0
        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);
        }
예제 #2
0
        public static void EnsurePopulated(IApplicationBuilder app)
        {
            AppMuscleDbContext context = app.ApplicationServices
                                         .GetRequiredService <AppMuscleDbContext>();

            context.Database.Migrate();
            if (!context.MuscleGroup.Any())
            {
                context.MuscleGroup.AddRange();


                context.SaveChanges();
            }
        }