public int DeleteComments(int?id) { var comment = Commentar.First(x => x.ID == id); int itemID = comment.GoodsID; Commentar.Remove(comment); this.SaveChanges(); return(itemID); }
public IActionResult AddComment(string text, int itemID) { var comment = new Commentar() { Text = text, GoodsID = itemID, UserName = User.Identity.Name }; repo.AddComments(comment); return(GetCommentsPartial(itemID)); }
public void AddComments(Commentar comment) { Commentar.Add(comment); this.SaveChanges(); }