示例#1
0
 public void DeleteMeasurement(Measurement measurement)
 {
     using (MySwoleMateEntities db = new MySwoleMateEntities())
     {
         db.Entry(measurement).State = System.Data.Entity.EntityState.Deleted;
         db.SaveChanges();
     }
 }
示例#2
0
 public void DeleteSchedule(Schedule schedule)
 {
     using (MySwoleMateEntities db = new MySwoleMateEntities())
     {
         db.Entry(schedule).State = System.Data.Entity.EntityState.Deleted;
         db.SaveChanges();
     }
 }
示例#3
0
 //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());
     }
 }
示例#4
0
        //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());
     }
 }