Example #1
0
        public async Task <IActionResult> Post([FromBody] PedidoViewModel entidade)
        {
            var result = await _mediator.SendCommadAsync(new AddPedidoCommand(entidade.ClienteId,
                                                                              entidade.PedidoItens,
                                                                              entidade.Cliente));

            if (result.StatusCode == Infrastructure.Shared.Constants.StatusCode.IsSuccess)
            {
                return(Ok(result));
            }
            else
            {
                return(BadRequest(result));
            }
        }
Example #2
0
        public async Task <IActionResult> Post([FromBody] ClienteViewModel entidade)
        {
            var result = await _mediator.SendCommadAsync(new
                                                         AddClientCommand(entidade.Nome,
                                                                          entidade.Telefone,
                                                                          entidade.CPF));

            if (result.StatusCode == Infrastructure.Shared.Constants.StatusCode.IsSuccess)
            {
                return(Ok(result));
            }
            else
            {
                return(BadRequest(result));
            }
        }