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"); }