public static void SaveOrUpdateTraining(Training val) { var context = new GymTrainingContext(); context.Entry(val).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); }
public static void DeleteTraining(decimal id) { var context = new GymTrainingContext(); var remove = context.Trainings.Single(x => x.Id == id); context.Trainings.Remove(remove); context.SaveChanges(); }