public bool Create(Comment pNewComment) { try { _db.Comments.Add(pNewComment); _db.SaveChanges(); return true; } catch { return false; } }
public bool Edit(int pId,Comment pNewComment) { try { var Object = _db.Comments.Find(pId); Object.CommentDate = pNewComment.CommentDate; Object.AccountID = pNewComment.AccountID; Object.PostID = pNewComment.PostID; Object.CommentLike = pNewComment.CommentLike; Object.CommentContent = pNewComment.CommentContent; Object.IsActive = pNewComment.IsActive; Object.LangId = pNewComment.LangId; Object.Permission = pNewComment.Permission; Object.ParentId = pNewComment.ParentId; _db.SaveChanges(); return true; } catch { return false; } }
public void SaveCommemntRealtime(Comment modelData) { dbContext = new ThangLongEntities(); dbContext.Comments.Add(modelData); }