Skip to content

Commit

Permalink
Merge pull request #81 from pedroMF1996/hotfix-pedidos
Browse files Browse the repository at this point in the history
Corrigindo problema de incompatibilidade entre carrinhoItem e Pedido …
  • Loading branch information
pedroMF1996 authored Oct 25, 2023
2 parents 5ffe55f + 993e15c commit 91e37d3
Show file tree
Hide file tree
Showing 26 changed files with 12 additions and 91 deletions.
Binary file modified NerdStoreEnterprise/.vs/NerdStoreEnterprise/v17/.suo
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class PedidoDTO
public string VoucherCodigo { get; set; }
public bool VoucherUtilizado { get; set; }

public List<ItemCarrinhoDTO> PedidoItems { get; set; } = new();
public List<ItemPedidoDTO> PedidoItems { get; set; } = new();

#endregion

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace NSE.Pedido.API.Application.Queries
{
public interface IPedidoQueries
{
Task<PedidoQueryDTO> ObterUltimoPedido(Guid clienteId);
Task<PedidoDTO> ObterUltimoPedido(Guid clienteId);
Task<IEnumerable<PedidoDTO>> ObterListaPorClienteId(Guid clienteId);
}
public class PedidoQueries : IPedidoQueries
Expand All @@ -25,7 +25,7 @@ public async Task<IEnumerable<PedidoDTO>> ObterListaPorClienteId(Guid clienteId)
return pedidos.Select(PedidoDTO.ParaPedidoDTO);
}

public async Task<PedidoQueryDTO> ObterUltimoPedido(Guid clienteId)
public async Task<PedidoDTO> ObterUltimoPedido(Guid clienteId)
{
const string sql = @"SELECT
P.ID AS 'ProdutoId', P.CODIGO, P.VOUCHERUTILIZADO, P.DESCONTO, P.VALORTOTAL,P.PEDIDOSTATUS,
Expand All @@ -44,17 +44,17 @@ AND P.DATACADASTRO between DATEADD(minute, -3, GETDATE()) and DATEADD(minute, 0
return MapearPedido(pedido);
}

private PedidoQueryDTO MapearPedido(dynamic result)
private PedidoDTO MapearPedido(dynamic result)
{
var pedido = new PedidoQueryDTO()
var pedido = new PedidoDTO()
{
Codigo = result[0].CODIGO,
Status = result[0].PEDIDOSTATUS,
ValorTotal = result[0].VALORTOTAL,
Desconto = result[0].DESCONTO,
VoucherUtilizado = result[0].VOUCHERUTILIZADO,

PedidoItems = new List<PedidoItemQueryDTO>(),
PedidoItems = new List<PedidoItemDTO>(),
Endereco = new EnderecoDTO
{
Logradouro = result[0].LOGRADOURO,
Expand All @@ -69,10 +69,10 @@ private PedidoQueryDTO MapearPedido(dynamic result)

foreach (var item in result)
{
var pedidoItem = new PedidoItemQueryDTO
var pedidoItem = new PedidoItemDTO
{
Nome = item.PRODUTONOME,
Valor = item.VALORUNITARIO,
ValorUnitario = item.VALORUNITARIO,
Quantidade = item.QUANTIDADE,
Imagem = item.PRODUTOIMAGEM
};
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8ebffdca359520bb3c5a9e2a9ec8a3363697f93b
18b70149bfbce1aa9d3671fca301f8c9d5ccd578
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class ItemPedidoViewModel
public Guid ProdutoId { get; set; }
public string Nome { get; set; }
public int Quantidade { get; set; }
public decimal Valor { get; set; }
public decimal ValorUnitario { get; set; }
public string Imagem { get; set; }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<p>
<b>@item.Nome</b>
</p>
<span>@this.UnidadesPorProdutoValorTotal(item.Quantidade, item.Valor) </span>
<span>@this.UnidadesPorProdutoValorTotal(item.Quantidade, item.ValorUnitario) </span>
</figcaption>
</figure>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<p>
<b>@item.Nome</b>
</p>
<span>@this.UnidadesPorProdutoValorTotal(item.Quantidade, item.Valor) </span>
<span>@this.UnidadesPorProdutoValorTotal(item.Quantidade, item.ValorUnitario) </span>
</figcaption>
</figure>
</li>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 91e37d3

Please sign in to comment.