示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }