Ejemplo n.º 1
0
        public async Task <Pedido> CreatePedido(string userId, Pedido pedido)
        {
            pedido.UsuarioId    = userId;
            pedido.Status       = "Creado";
            pedido.RepartidorId = 1;
            await validateUserId(userId);

            var pedidoEntity = mapper.Map <PedidoEntity>(pedido);

            ARBRepository.CreatePedido(pedidoEntity);
            if (await ARBRepository.SaveChangesAsync())
            {
                return(mapper.Map <Pedido>(pedidoEntity));
            }
            throw new Exception("there where and error with the DB");
        }