private List <Clases.Proporcion> ConvertirListaDeProporcionesDatosALogica(List <AccesoADatos.PlatilloIngrediente> ProporcionesDb) { List <Clases.Proporcion> proporcionesConvertidas = new List <Clases.Proporcion>(); foreach (PlatilloIngrediente proporcion in ProporcionesDb) { Clases.Proporcion proporcionConvertida = ConvertirProporcionDeAccesoADatosAProporcionDeLogica(proporcion); proporcionesConvertidas.Add(proporcionConvertida); } return(proporcionesConvertidas); }
private Clases.Proporcion ConvertirProporcionDeAccesoADatosAProporcionDeLogica(AccesoADatos.PlatilloIngrediente proporcionDb) { IngredienteDAO ingredienteDAO = new IngredienteDAO(); Clases.Proporcion proporcionConvertida = new Clases.Proporcion { Id = proporcionDb.Id, Cantidad = proporcionDb.Cantidad, Ingrediente = ingredienteDAO.ConvertirDeDatosALogica(proporcionDb.Ingrediente) }; return(proporcionConvertida); }
public AccesoADatos.PlatilloIngrediente ConvertirLogicaADb(Clases.Proporcion Proporcion) { AccesoADatos.PlatilloIngrediente proporcionConvertida = new PlatilloIngrediente() { Id = Proporcion.Id, Cantidad = Proporcion.Cantidad, }; IngredienteDAO ingredienteDAO = new IngredienteDAO(); proporcionConvertida.Ingrediente = ingredienteDAO.ConvertirDeLogicaADb(Proporcion.Ingrediente); proporcionConvertida.Ingrediente.PlatilloIngredientes = new List <PlatilloIngrediente>() { proporcionConvertida }; return(proporcionConvertida); }
private AccesoADatos.PlatilloIngrediente ConvertirProporcionDeLogicaAProporcionDeAccesoADatosParaEdicion(Clases.Proporcion Proporcion) { PlatilloIngrediente proporcionConvertida = new PlatilloIngrediente(); using (ModeloDeDatosContainer context = new ModeloDeDatosContainer()) { proporcionConvertida = context.PlatilloIngrediente.Find(Proporcion.Id); } proporcionConvertida.Cantidad = Proporcion.Cantidad; IngredienteDAO ingredienteDAO = new IngredienteDAO(); proporcionConvertida.Ingrediente = ingredienteDAO.ConvertirDeLogicaADb(Proporcion.Ingrediente); proporcionConvertida.Ingrediente.PlatilloIngredientes = new List <PlatilloIngrediente>() { proporcionConvertida }; return(proporcionConvertida); }