Example #1
0
        public ActionResult StworzKomentarzJava(int id, string content)
        {
            Debug.WriteLine(id + content);

            Comments comment = new Comments();

            comment.content = content;
            comment.User_ID = ObsługaBazyDanych.zwrocIdUzytkownikaPoUsername(User.Identity.Name);
            ObsługaBazyDanych.dodajKomentarz(id, comment);

            return(Json(new { id1 = id }, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public ActionResult StworzKomentarz(Comments comment)
        {
            var idPostu = (int)TempData["PostCommentId"];

            if (ModelState.IsValid)
            {
                comment.User_ID = ObsługaBazyDanych.zwrocIdUzytkownikaPoUsername(User.Identity.Name);
                ObsługaBazyDanych.dodajKomentarz(idPostu, comment);
                return(RedirectToAction("WyswietlPost", new { id = idPostu }));
            }
            return(View());
        }