コード例 #1
0
        public StudentLecturerEntity Update(UserEntity userEntity, Guid StudentId, StudentLecturerEntity studentLectureEntity)
        {
            StudentLecturer studentLecturer = IMSContext.StudentLecturers.Where(sl => sl.StudentId == StudentId).FirstOrDefault();

            studentLectureEntity.ToModel(studentLecturer);
            IMSContext.SaveChanges();
            return(null);
        }
コード例 #2
0
        public StudentLecturerEntity Create(UserEntity userEntity, StudentLecturerEntity studentLecturerEntity)
        {
            StudentLecturer studentLecturer = studentLecturerEntity.ToModel();

            IMSContext.StudentLecturers.Add(studentLecturer);
            IMSContext.SaveChanges();
            return(studentLecturerEntity);
        }
コード例 #3
0
 public StudentLecturer ToModel(StudentLecturer studentLecturer = null)
 {
     if (studentLecturer == null)
     {
         studentLecturer = new StudentLecturer();
     }
     studentLecturer.StudentId  = this.StudentId;
     studentLecturer.LecturerId = this.LecturerId;
     return(studentLecturer);
 }
コード例 #4
0
        public StudentLecturerEntity Get(UserEntity userEntity, Guid StudentId)
        {
            StudentLecturer studentLecturer = IMSContext.StudentLecturers.Where(sl => sl.StudentId == StudentId).FirstOrDefault();

            if (studentLecturer == null)
            {
                throw new BadRequestException("StudentLecturer không tồn tại! ");
            }
            return(new StudentLecturerEntity(studentLecturer));
        }
コード例 #5
0
        public bool Delete(UserEntity userEntity, Guid StudentId)
        {
            StudentLecturer studentLecturer = IMSContext.StudentLecturers.Where(sl => sl.StudentId == StudentId).FirstOrDefault();

            if (studentLecturer == null)
            {
                throw new BadRequestException("StudentLecturer không tồn tại!");
            }
            IMSContext.Remove(studentLecturer);
            IMSContext.SaveChanges();
            return(true);
        }
コード例 #6
0
 public StudentLecturerEntity(StudentLecturer studentLecturer)
 {
     this.StudentId  = studentLecturer.StudentId;
     this.LecturerId = studentLecturer.LecturerId;
 }