Beispiel #1
0
        //[ValidationAspect(typeof(ExamValidator), Priority = 1)]
        //[CacheRemoveAspect("IExamService.Get")]
        public IResult Add(ExamDto examDto)
        {
            var exam = new Exam
            {
                Title             = examDto.Title,
                Information       = examDto.Information,
                NumberOfQuestions = examDto.NumberOfQuestions,
                AddedAt           = DateTime.Now,
                StartTime         = DateTime.Parse(examDto.StartTime),
                EndTime           = DateTime.Parse(examDto.EndTime)
            };

            IResult result = BusinessRules.Run(CheckIfExamNameExists(exam.Title));

            if (result != null)
            {
                return(result);
            }

            _examDal.Add(exam);
            return(new SuccessResult(Messages.ExamAdded));
        }
Beispiel #2
0
        public void Add(ExamDto examDto)
        {
            var exam = new Exam
            {
                Title             = examDto.Title,
                Information       = examDto.Information,
                NumberOfQuestions = examDto.NumberOfQuestions,
                AddedAt           = DateTime.Now,
                StartTime         = DateTime.Parse(examDto.StartTime),
                EndTime           = DateTime.Parse(examDto.EndTime)
            };

            _examDal.Add(exam);
        }
Beispiel #3
0
 public void Add(Exam entity)
 {
     _examDal.Add(entity);
 }