public IResult AddLesson(Lesson lesson, int userId)
        {
            if (_lessonDal.IsStudent(userId))
            {
                return(new ErrorResult(Messages.UnauthorizedAccess));
            }
            var AlreadyInDb = _lessonDal.Get(l => l.LessonCRN == lesson.LessonCRN);

            if (AlreadyInDb != null)
            {
                return(new ErrorResult(Messages.LessonAlreadyInDb));
            }

            bool result = _lessonDal.Add(lesson);

            if (result == true)
            {
                return(new SuccessResult(Messages.LessonAddSucceed));
            }
            else
            {
                return(new ErrorResult(Messages.LessonAddFailed));
            }
        }
Esempio n. 2
0
 public Lessons Get(int id)
 {
     return(lessonDal.Get(id));
 }
Esempio n. 3
0
 public IDataResult <Lesson> GetById(int id)
 {
     return(new SuccessDataResult <Lesson>(_lessonDal.Get(p => p.LessonId == id)));
 }