Beispiel #1
0
        // Cập nhật Lecturer theo id
        public LecturerEntity Update(UserEntity UserEntity, Guid LecturerId, LecturerEntity LecturerEntity)
        {
            Lecturer Lecturer = IMSContext.Lecturers.Where(l => l.Id == LecturerId).FirstOrDefault();

            LecturerEntity.ToModel(Lecturer);
            IMSContext.SaveChanges();
            return(LecturerEntity);
        }
Beispiel #2
0
        // Tạo mới Lecturer
        public LecturerEntity Create(UserEntity UserEntity, LecturerEntity LecturerEntity)
        {
            Lecturer Lecturer = LecturerEntity.ToModel();
            User     User     = new User();

            User.Id       = Lecturer.Id;
            User.Username = LecturerEntity.Username;
            User.Password = "******";

            IMSContext.Users.Add(User);
            IMSContext.Lecturers.Add(Lecturer);
            IMSContext.SaveChanges();
            return(Get(UserEntity, Lecturer.Id));
        }