public ActionResult AddKoment(string Komenatar, int? aid)
        {
            User user = Autorizacija.Autorizacija.GetCurrentUser(this.HttpContext);
            if (!aid.HasValue && string.IsNullOrEmpty(Komenatar))
                return RedirectToAction("Index", "Wellcome");
            int ArticlesID = aid.Value;
            try
            {

                Comment c = new Comment();

                c.CreatorName = user.FirstName + " " + user.LastName;
                c.CreatorUserAgent = this.Request.UserAgent;
                c.CreatorIP = this.Request.GetIpAdresa();
                c.GUID = Guid.NewGuid();
                c.IsActive = true;
                c.IsSpam = false;
                c.CreatorEmail = user.Email;
                c.Created = DateTime.Now;
                c.CreatedByUserID = user.UserID;
                c.Body = Komenatar;
                c.ArticleID = ArticlesID;

                using (DBBL Baza = new DBBL())
                {
                    Baza.AddKomentar(c);
                }

            }
            catch (Exception) { }
            return RedirectToRoute("GetWikiRoute", new { id = ArticlesID });
        }
        public ActionResult CommentAnswer(string Komentar, int id)
        {
            Comment comment = new Comment();
            comment.AnswerID = id;
            comment.Body = Server.HtmlDecode(Komentar).Replace("'", "'");
            comment.GUID = Guid.NewGuid();
            comment.Created = DateTime.Now;
            comment.CreatorUserAgent = this.HttpContext.Request.UserAgent;
            comment.CreatorIP = this.HttpContext.Request.GetIpAdresa();
            comment.CreatorName = Autorizacija.Autorizacija.GetCurrentUser(this.HttpContext).FirstName;
            comment.CreatorEmail = Autorizacija.Autorizacija.GetCurrentUser(this.HttpContext).Email;
            comment.CreatedByUserID = Autorizacija.Autorizacija.GetCurrentUser(this.HttpContext).UserID;
            comment.IsActive = true;
            comment.IsSpam = false;
            var Url = Request.UrlReferrer;
            _db.Add_Comment(comment);
            TempData["KomentSuccess"] = true;

            return Redirect(Url.ToString());
        }
Exemplo n.º 3
0
 public void AddKomentar(Comment c)
 {
     context.Comments.Add(c);
     context.SaveChanges();
 }
Exemplo n.º 4
0
 public void Add_Comment(Comment c)
 {
     context.Database.ExecuteSqlCommand("EXEC [dbo].[usp_CommentInsert] {0},{1},{2},{3},{4},null,{5},{6},{7},{8},{9},null,null,null,{10}", c.GUID, c.CreatorIP, c.CreatorUserAgent, c.CreatorEmail, c.CreatorName, c.Body, c.IsActive, c.IsSpam, c.Created, c.CreatedByUserID, c.AnswerID);
 }