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)); } }
public Lessons Get(int id) { return(lessonDal.Get(id)); }
public IDataResult <Lesson> GetById(int id) { return(new SuccessDataResult <Lesson>(_lessonDal.Get(p => p.LessonId == id))); }