public RecipeEN getRecipe(int id) { RecipeCAD recipe = new RecipeCAD(); return recipe.getRecipe(id); }
// 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; }