Example #1
0
        public int DeleteComments(int?id)
        {
            var comment = Commentar.First(x => x.ID == id);
            int itemID  = comment.GoodsID;

            Commentar.Remove(comment);
            this.SaveChanges();
            return(itemID);
        }
Example #2
0
        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));
        }
Example #3
0
 public void AddComments(Commentar comment)
 {
     Commentar.Add(comment);
     this.SaveChanges();
 }