Пример #1
0
        public async Task <ActionResult> Post(Cupom cupom)
        {
            try
            {
                await _repository.Add(cupom);

                await _uow.Commit();

                return(CreatedAtAction("Post", await Get(cupom.Id)));
            }
            catch (Exception ex)
            {
                await _uow.Rollback();

                return(BadRequest(ex));
            }
        }
Пример #2
0
        protected override Task Handle(CriarCupomCommand command, CancellationToken cancellationToken)
        {
            var cupom = new Cupom(command.CodigoCupom);

            return(_cupomRepository.Add(cupom));
        }