Exemple #1
0
        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);
        }
Exemple #2
0
        public LecturerFollowEntity Create(UserEntity UserEntity, LecturerFollowEntity LecturerFollowEntity)
        {
            LecturerFollow LecturerFollow = LecturerFollowEntity.ToModel();

            IMSContext.LecturerFollows.Add(LecturerFollow);
            IMSContext.SaveChanges();
            return(LecturerFollowEntity);
        }
Exemple #3
0
        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));
        }
Exemple #4
0
 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;
 }
Exemple #5
0
        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);
        }
Exemple #6
0
 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);
 }
Exemple #7
0
 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);
         }
     }
 }