private void AppButtonAgregar_Click(object sender, RoutedEventArgs e) { int cantidad = int.Parse(TextBoxCantidadProductos.Text); ProductoCantidad pc = new ProductoCantidad() { Producto = tmpProduct, Cantidad = cantidad }; double PrecioU = GetPrecio(pc); double PrecioT = PrecioU * cantidad; NuevoRequestProduct = new RequestProduct {PName = tmpProduct.Name, PNItems = cantidad, PPriceU = PrecioU, PPriceT = PrecioT, PurlImage = tmpProduct.Pictures.FirstOrDefault().URL}; Pedido.Pedidos.Add(NuevoRequestProduct); AppButtonAgregar.IsEnabled = false; }
private double GetPrecio(ProductoCantidad x) { double precio = 0; foreach (var material in x.Producto.Materials) { precio += material.UnitPrice; } return(precio); }
private void AppButtonAgregar_Click(object sender, RoutedEventArgs e) { int cantidad = int.Parse(TextBoxCantidadProductos.Text); ProductoCantidad pc = new ProductoCantidad() { Producto = tmpProduct, Cantidad = cantidad }; double PrecioU = GetPrecio(pc); double PrecioT = PrecioU * cantidad; NuevoRequestProduct = new RequestProduct { PName = tmpProduct.Name, PNItems = cantidad, PPriceU = PrecioU, PPriceT = PrecioT, PurlImage = tmpProduct.Pictures.FirstOrDefault().URL }; Pedido.Pedidos.Add(NuevoRequestProduct); AppButtonAgregar.IsEnabled = false; }
private double GetPrecio(ProductoCantidad x) { double precio = 0; foreach (var material in x.Producto.Materials) { precio += material.UnitPrice; } return precio; }