public void DeleteMeasurement(Measurement measurement) { using (MySwoleMateEntities db = new MySwoleMateEntities()) { db.Entry(measurement).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); } }
public void DeleteSchedule(Schedule schedule) { using (MySwoleMateEntities db = new MySwoleMateEntities()) { db.Entry(schedule).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); } }
//Edit Schedule public int EditSchedule(Schedule editSc) { using (MySwoleMateEntities db = new MySwoleMateEntities()) { var sc = new Schedule { ScheduleID = editSc.ScheduleID, ScheduleDtTime = editSc.ScheduleDtTime, InputDtTime = editSc.ScheduleDtTime, TraineeID = editSc.TraineeID }; db.Entry(sc).State = System.Data.Entity.EntityState.Modified; return(db.SaveChanges()); } }
//Delete a Schedule public void DeleteSchedule(int scId) { Schedule deleteSc = new Schedule() { ScheduleID = scId }; using (MySwoleMateEntities db = new MySwoleMateEntities()) { db.Entry(deleteSc).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); } }
//Delete a Measurement public void DeleteMeasurement(int mesId) { Measurement deleteMes = new Measurement() { MeasurementID = mesId }; using (MySwoleMateEntities db = new MySwoleMateEntities()) { db.Entry(deleteMes).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); } }
//Edit Measurement public int EditMeasurement(Measurement editMes) { using (MySwoleMateEntities db = new MySwoleMateEntities()) { var m = new Measurement { MeasurementID = editMes.MeasurementID, Weight = editMes.Weight, Waist = editMes.Waist, BodyFat = editMes.BodyFat, Chest = editMes.Chest, UpperArm = editMes.UpperArm, ScheduleID = editMes.ScheduleID }; db.Entry(m).State = System.Data.Entity.EntityState.Modified; return(db.SaveChanges()); } }