public async Task <ActionResult> CreateBulletinSection([FromBody] CreateBulletinSectionRequestDto requestDto) { if (!ModelState.IsValid) { throw new ValidationException("Model is not valid."); } await Executor.GetCommand <CreateBulletinSectionCommand>() .Process(c => c.Execute(requestDto)); return(Ok()); }
public async Task Execute(CreateBulletinSectionRequestDto requestDto) { var bulletinSectionRepository = Uow.GetRepository <BulletinSection>(); var bulletinSection = new BulletinSection { Name = requestDto.Name, DateCreate = DateTimeOffset.Now }; await bulletinSectionRepository.CreateAsync(bulletinSection); await Uow.SaveChangesAsync(); }