예제 #1
0
        public static Comentario GetComment(Guid idPizza)
        {
            MydbContex db      = new MydbContex();
            var        comment = db.Comentario.Where(num => num.Pizza == idPizza).OrderByDescending(num => num.Fecha).ToList();

            return(comment.ElementAt(0));
        }
예제 #2
0
        public static void SelectIdbyNick(String user)
        {
            //
            MydbContex db      = new MydbContex();
            var        usuario = db.Usuario.Where(num => num.Email.Equals(user)).ToList();

            //Consulta equivalente con sql extension
            //  var usuario2 = (from user3 in db.Usuario  where user3.Email.Equals(user) select  user3.Id );

            Id = usuario.ElementAt(0).Id;
        }
예제 #3
0
        public static Comentario GetComment(Guid idPizza)
        {
            MydbContex db      = new MydbContex();
            var        comment = db.Comentario.Where(num => num.Pizza == idPizza).OrderByDescending(num => num.Fecha).ToList();

            try
            {
                return(comment.ElementAt(0));
            }
            catch (ArgumentOutOfRangeException)
            {
                throw new Exception("Pizza sin comentarios");
            }
        }
예제 #4
0
        private void SelectLastPizzas()
        {
            MydbContex db       = new MydbContex();
            Pizza      p        = new Pizza();
            int        contador = 0;

            foreach (var pizza in db.Pizza)
            {
                if (contador == maxResults)
                {
                    break;
                }
                pizzaList.Add(pizza);
                contador++;
            }
        }
예제 #5
0
        public static List <Ingrediente> LoadIngredients()
        {
            MydbContex db = new MydbContex();

            return(db.Ingrediente.ToList());
        }