public LecturerFollowEntity Update(UserEntity UserEntity, Guid LecturerId, LecturerFollowEntity LecturerFollowEntity) { LecturerFollow LecturerFollow = IMSContext.LecturerFollows.Where(l => l.Id == LecturerId).FirstOrDefault(); LecturerFollowEntity.ToModel(LecturerFollow); IMSContext.SaveChanges(); return(null); }
public LecturerFollowEntity Create(UserEntity UserEntity, LecturerFollowEntity LecturerFollowEntity) { LecturerFollow LecturerFollow = LecturerFollowEntity.ToModel(); IMSContext.LecturerFollows.Add(LecturerFollow); IMSContext.SaveChanges(); return(LecturerFollowEntity); }
public LecturerFollowEntity Get(UserEntity UserEntity, Guid LecturerId) { LecturerFollow LecturerFollow = IMSContext.LecturerFollows.Where(u => u.Id == LecturerId).FirstOrDefault(); if (LecturerFollow == null) { throw new BadRequestException("LecturerFollow không tồn tại"); } return(new LecturerFollowEntity(LecturerFollow)); }
public LecturerFollowEntity(LecturerFollow LecturerFollow) { this.Id = LecturerFollow.Id; this.StudentId = LecturerFollow.StudentId; this.LecturerId = LecturerFollow.LecturerId; this.Status = LecturerFollow.Status; this.LecturerEntity = LecturerFollow.Lecturer == null ? null : new LecturerEntity(LecturerFollow.Lecturer); this.StudentEntity = LecturerFollow.Student == null ? null : new StudentEntity(LecturerFollow.Student); //this.Start = LecturerFollow.Start; //this.End = LecturerFollow.End; }
public bool Delete(UserEntity UserEntity, Guid LecturerId) { LecturerFollow LecturerFollow = IMSContext.LecturerFollows.Where(u => u.Id == LecturerId).FirstOrDefault(); if (LecturerFollow == null) { throw new BadRequestException("LecturerFollow không tồn tại."); } IMSContext.LecturerFollows.Remove(LecturerFollow); IMSContext.SaveChanges(); return(true); }
public LecturerFollow ToModel(LecturerFollow LecturerFollow = null) { if (LecturerFollow == null) { LecturerFollow = new LecturerFollow(); LecturerFollow.Id = Guid.NewGuid(); } LecturerFollow.LecturerId = this.LecturerId; LecturerFollow.Status = this.Status; LecturerFollow.Start = this.Start; LecturerFollow.End = this.End; return(LecturerFollow); }
public LecturerFollowEntity(LecturerFollow LecturerFollow, params object[] args) { this.Id = LecturerFollow.Id; this.StudentId = LecturerFollow.StudentId; this.LecturerId = LecturerFollow.LecturerId; this.Status = LecturerFollow.Status; this.LecturerEntity = LecturerFollow.Lecturer == null ? null : new OperationEntity(LecturerFollow.Lecturer); this.StudentEntity = LecturerFollow.Student == null ? null : new StudentEntity(LecturerFollow.Student); //this.Start = LecturerFollow.Start; //this.End = LecturerFollow.End; foreach (var arg in args) { if (arg is Company) { this.LecturerEntity = LecturerFollow.Lecturer == null ? null : new OperationEntity(arg as Lecturer); } if (arg is Student) { this.StudentEntity = LecturerFollow.Student == null ? null : new StudentEntity(arg as Student); } } }