public List<Comment> GetComments() { var list = new List<Comment>(); var result = QueryStoreProcedure("GetComments", new Dictionary<string, object>()); if (result.Tables[0].Rows.Count > 0) { foreach (DataRow row in result.Tables[0].Rows) { var comment = new Comment().FromRow(row); list.Add(comment); } } return list; }
public Comment AddComment(Comment newComment) { var result = QueryStoreProcedure("AddComment", new Dictionary<string, object> { {"param_accountId", newComment.AccountId}, {"param_content", newComment.Content}, }); if (result.Tables.Count > 1 && result.Tables[1].Rows.Count > 0) { var comment = new Comment().FromRow(result.Tables[1].Rows[0]); return comment; } return null; }