/// <summary> /// Agrega un unico insumo al stock de la fábrica /// </summary> /// <param name="insumo"></param> /// <returns></returns> public bool AgregarInsumosAStock(Insumo insumo) { bool output = false; if (!(insumo is null)) { this.stockInsumos += insumo; output = true; } return(output); }
/// <summary> /// Agrega un unico insumo al stock de la fábrica /// </summary> /// <param name="insumo"></param> /// <returns></returns> public bool AgregarInsumosAStock(Insumo insumo) { bool output = false; if (!(insumo is null)) { insumoService.CreateEntity(insumo); output = true; EmitirEvento(); } return(output); }
/// <summary> /// /// </summary> /// <param name="insumosASeparar"></param> /// <returns></returns> private void SepararInsumos(List <Insumo> insumosASeparar) { foreach (Insumo i in insumosASeparar) { Insumo bufferInsumo = insumoService.GetEntityById(i); bufferInsumo.Cantidad = bufferInsumo.Cantidad - i.Cantidad; if (bufferInsumo.Cantidad > 0) { insumoService.UpdateEntity(bufferInsumo); } else { insumoService.DeleteEntity(bufferInsumo); } } EmitirEvento(); }