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")); }
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")); }
public void AddComment(Koment comment) { db.Komentet.Add(comment); db.SaveChanges(); }
public void AddComment(Koment k) { repository.AddComment(k); }