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); }
public StudentLecturerEntity Create(UserEntity userEntity, StudentLecturerEntity studentLecturerEntity) { StudentLecturer studentLecturer = studentLecturerEntity.ToModel(); IMSContext.StudentLecturers.Add(studentLecturer); IMSContext.SaveChanges(); return(studentLecturerEntity); }
public StudentLecturer ToModel(StudentLecturer studentLecturer = null) { if (studentLecturer == null) { studentLecturer = new StudentLecturer(); } studentLecturer.StudentId = this.StudentId; studentLecturer.LecturerId = this.LecturerId; return(studentLecturer); }
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)); }
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); }
public StudentLecturerEntity(StudentLecturer studentLecturer) { this.StudentId = studentLecturer.StudentId; this.LecturerId = studentLecturer.LecturerId; }