Exemplo n.º 1
0
        public async Task UpdateControlEventAsync(UpdateControlEventModel updateModel)
        {
            if (updateModel == null || updateModel.IsEmpty())
            {
                throw new ExceptionTypes.NullValueException();
            }

            if (updateModel.Id < 1)
            {
                throw new ExceptionTypes.IncorrectIdException();
            }

            if (!await _repository.ExistAsync(updateModel.Id))
            {
                throw new ExceptionTypes.IdNotFoundException();
            }

            if (updateModel.MaxMark > 10 || updateModel.MaxMark < 0)
            {
                throw new ExceptionTypes.IncorrectMarkException();
            }

            MailingService.CheckDate(updateModel.Date);


            await _repository.UpdateAsync(updateModel);
        }
Exemplo n.º 2
0
        public async Task <ControlEvent> CreateControlEventAsync(ControlEvent controlEvent)
        {
            if (controlEvent == null)
            {
                throw new ExceptionTypes.NullValueException();
            }

            if (controlEvent.Name == null)
            {
                throw new ExceptionTypes.IncorrectNameException();
            }

            MailingService.CheckDate(controlEvent.Date);
            return(await _repository.CreateControlEventAsync(controlEvent));
        }