コード例 #1
0
 public void DeleteUser(int id)
 {
     using (MCenterDBContext db = new MCenterDBContext())
     {
         user_data deletedIns = getUserByID(id);
         //  db.instructors.Remove(deletedIns);
         db.Entry(deletedIns).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
コード例 #2
0
 public static void UpdateInstructor(instructorVM instructorvm)
 {
     using (MCenterDBContext db = new MCenterDBContext())
     {
         instructor updataedInstructor = getInstructorByID(instructorvm.instructor_id);
         updataedInstructor.instructor_name    = instructorvm.instructor_name;
         updataedInstructor.NameOf_ItsUnit     = instructorvm.NameOf_ItsUnit;
         updataedInstructor.TrainningTopic     = instructorvm.TrainningTopic;
         updataedInstructor.Current_JobTitle   = instructorvm.Current_JobTitle;
         updataedInstructor.Mobile             = instructorvm.Mobile;
         updataedInstructor.phone              = instructorvm.phone;
         updataedInstructor.Email              = instructorvm.Email;
         updataedInstructor.QualificationsName = instructorvm.QualificationsName;
         db.Entry(updataedInstructor).State    = EntityState.Modified;
         db.SaveChanges();
     }
 }
コード例 #3
0
        public void UpdateUser(UsersVM userVm)
        {
            using (MCenterDBContext db = new MCenterDBContext())
            {
                user_data updataedUser = getUserByID(userVm.user_id);
                updataedUser.user_name        = userVm.user_name;
                updataedUser.age              = userVm.age;
                updataedUser.email            = userVm.email;
                updataedUser.national_id      = userVm.national_id;
                updataedUser.address          = userVm.address;
                updataedUser.phone            = userVm.phone;
                updataedUser.qualification_id = userVm.qualification_id;
                updataedUser.loginUserName    = userVm.loginUserName;
                updataedUser.password         = userVm.password;

                db.Entry(updataedUser).State = EntityState.Modified;
                db.SaveChanges();
            }
        }