示例#1
0
        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());
        }
示例#2
0
        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();
        }