public List<RecipeEN> getRecipes(string identificador) { RecipeCAD recipes = new RecipeCAD(); return recipes.getRecipes(identificador, this); }
public bool INSERT() { RecipeCAD u = new RecipeCAD(); if (u.addRecipe(this)) { return true; } else { return false; } }
public RecipeEN getRecipe(int id) { RecipeCAD recipe = new RecipeCAD(); return recipe.getRecipe(id); }
public BookEN getBook() { RecipeCAD recipe = new RecipeCAD(); return recipe.getBook(this); }
/*public bool UPDATE() { RecipeCAD u = new RecipeCAD(); if (u.updateRecipe(this, id)) { return true; } else { return false; } }*/ public bool DELETE() { RecipeCAD u = new RecipeCAD(); if (u.deleteRecipe(this)) { return true; } else { return false; } }
public List<CommentEN> CommentsPerRecipe(RecipeEN recipe) { RecipeCAD receta = new RecipeCAD(); return receta.getComments(recipe); }
// Returns a list with the recipes that a user have done public List<RecipeEN> RecipesUser(UserEN user) { List<RecipeEN> lista = new List<RecipeEN>(); RecipeCAD recipeCad = new RecipeCAD(); RecipeEN recipe; SqlConnection c = new SqlConnection(db); try { c.Open(); SqlCommand com = new SqlCommand("SELECT Id FROM Recipe WHERE User = '******'", c); SqlDataReader dr = com.ExecuteReader(); while (dr.Read()) { recipe = recipeCad.getRecipe(long.Parse(dr["Id"].ToString())); lista.Add(recipe); } dr.Close(); } catch (Exception ex) { } finally { c.Close(); } return lista; }