Beispiel #1
0
        public EditStudentViewModel MapStudent(User user)
        {
            var model = new EditStudentViewModel {
                UserId = user.Id,
                FirstName = user.FirstName,
                LastName = user.LastName,
                Sex = user.Sex,
                Email = user.Email,
                Phone = user.PhoneNumber
            };

            return model;
        }
Beispiel #2
0
        public void EditStudent(EditStudentViewModel model)
        {
            var user = db.Users.Find(model.UserId);

            user.FirstName = model.FirstName;
            user.LastName = model.LastName;
            user.Sex = model.Sex;
            user.Email = model.Email;
            user.UserName = model.Email;
            user.PhoneNumber = model.Phone;

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