private void btnActualizar_Click(object sender, EventArgs e) { var ingreso = iservice.ReadIngresoByID(Codigo_ingreso); var producto = pservice.ReadByIdProducto(ingreso.Codigo_Producto); //actualizamos el stock de producto producto.Stock = producto.Stock - (ingreso.Cantidad - Convert.ToInt32(nudCantidad.Text)); ingreso.Fecha_Ingreso = dtFechaIngreso.Value; ingreso.FechaVen = dtFechaVencimiento.Value; ingreso.Tipo_Comprobante = cbComprobante.Text; ingreso.Codigo_Ingreso = Codigo_ingreso; ingreso.Codigo_Producto = producto.Codigo_Producto; ingreso.Cantidad = Convert.ToInt32(nudCantidad.Text); ingreso.Total = decimal.Parse(iservice.CalcularTotal(Convert.ToDouble(producto.Precio), ingreso.Cantidad).ToString()); iservice.Update(ingreso); pservice.Update(producto); MessageBox.Show("Se ha actualizado la orden de ingreso."); this.Close(); }
public ActionResult Put([FromBody] Ingreso ingreso) { return(Ok( ingresoService.Update(ingreso) )); }