public bool UPDATE() { CommentsCAD u = new CommentsCAD(); return u.UPDATE(this); }
public CommentEN READ(long cod) { CommentsCAD u = new CommentsCAD(); return u.READ(cod); }
public bool DELETE() { CommentsCAD u = new CommentsCAD(); return u.DELETE(this.code); }
public bool INSERT() { CommentsCAD u = new CommentsCAD(); return u.INSERT(this); }
/*public bool updateRecipe(RecipeEN recipe, long id) { bool updated = false; SqlConnection c = new SqlConnection(db); try { c.Open(); SqlCommand com = new SqlCommand("", c); com.ExecuteNonQuery(); updated = true; } catch (Exception ex) { updated=false;} finally { c.Close(); } return updated; }*/ public List<CommentEN> getComments(RecipeEN reci) { List<CommentEN> lista = new List<CommentEN>(); CommentsCAD recipeCad = new CommentsCAD(); CommentEN recipe; SqlConnection c = new SqlConnection(db); try { c.Open(); SqlCommand com = new SqlCommand("SELECT Code FROM Ternary WHERE Id = " + reci.Id, c); SqlDataReader dr = com.ExecuteReader(); while (dr.Read()) { recipe = recipeCad.READ(long.Parse(dr["Id"].ToString())); lista.Add(recipe); } dr.Close(); } catch (Exception ex) { } finally { c.Close(); } return lista; }