Ejemplo n.º 1
0
        public ActionResult sendComment(int tiskarnaID, string comment, DateTime time, int parentID)
        {
            var commentE = new Printajmo.Models.Comments();

            commentE.idTiskarna = tiskarnaID;
            commentE.idUser     = User.Identity.GetUserId();
            //commentC.parrentID = parentID;
            commentE.comment = comment;
            commentE.time    = time;
            commentE.name    = User.Identity.Name;
            commentE.img     = "~/img/profile-icon.png";

            _db.Comments.Add(commentE);
            _db.SaveChanges();
            return(PartialView("_Comments", getComments(tiskarnaID)));
        }
Ejemplo n.º 2
0
        public JObject comment(string idtiskarne, string comment, string name, string time, string idUser, string parentID, string img)
        {
            int      idTiskarne  = Convert.ToInt32(idtiskarne);
            DateTime dateTime    = DateTime.ParseExact(time, "yyyy-MM-dd'T'HH:mm:ss'Z'", CultureInfo.InvariantCulture);
            int      parentIDint = Convert.ToInt32(parentID);

            var commentObj = new Printajmo.Models.Comments();

            commentObj.idTiskarna = idTiskarne;
            commentObj.comment    = comment;
            commentObj.name       = name;
            commentObj.time       = dateTime;
            commentObj.idUser     = idUser;
            commentObj.parrentID  = parentIDint;
            commentObj.img        = img;

            _db.Comments.Add(commentObj);
            _db.SaveChanges();

            String  output = "{\"success\":1}";
            JObject json   = JObject.Parse(output);

            return(json);
        }