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)); }
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; }
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"); } }
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++; } }
public static List <Ingrediente> LoadIngredients() { MydbContex db = new MydbContex(); return(db.Ingrediente.ToList()); }