コード例 #1
0
        public ActionResult PostComment(string CommentText)
        {
            string userId = User.Identity.GetUserId();

            //Komenti eshte bosh
            if (string.IsNullOrEmpty(CommentText))
            {
                return(RedirectToAction("Index"));
            }
            //Shtimi komentit
            Koment c = new Koment()
            {
                Teksti        = CommentText,
                DataEKrijimit = DateTime.Now,
                AutoriId      = userId
            };

            commentService.AddComment(c);
            this.AddNotification("Komenti u postua.", NotificationType.SUCCESS);
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public ActionResult PostReply(string Replytext, int CID)
        {
            string userId = User.Identity.GetUserId();

            //Textbox i reply eshte bosh
            if (string.IsNullOrEmpty(Replytext))
            {
                return(RedirectToAction("Index"));
            }
            //Shtimi i reply
            Koment reply = new Koment()
            {
                Teksti        = Replytext,
                AutoriId      = userId,
                DataEKrijimit = DateTime.Now,
                KomentId      = CID
            };

            commentService.AddComment(reply);
            this.AddNotification("Pergjigja u shtua.", NotificationType.SUCCESS);
            return(RedirectToAction("Index"));
        }
コード例 #3
0
 public void AddComment(Koment comment)
 {
     db.Komentet.Add(comment);
     db.SaveChanges();
 }
コード例 #4
0
 public void AddComment(Koment k)
 {
     repository.AddComment(k);
 }