示例#1
0
        public ActionResult Create(Comment comment, int?articleid)
        {
            ModelState.Remove("CreatedOn");
            ModelState.Remove("ModifiedOn");
            ModelState.Remove("ModifierUser");

            if (ModelState.IsValid)
            {
                if (articleid == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }

                Article article = article_mngr.Find(x => x.Id == articleid);

                if (article == null)
                {
                    return(new HttpNotFoundResult());
                }

                comment.Articles = article; //Bu comment'in Article'ı kim
                comment.Owner    = CurrentSession.User;

                if (comment_mngr.Insert(comment) > 0)
                {
                    return(Json(new { result = true }, JsonRequestBehavior.AllowGet)); //islem basarili ise
                }
            }

            return(Json(new { result = false }, JsonRequestBehavior.AllowGet)); //islem basarisiz ise
        }
示例#2
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Article article = article_mngr.Find(x => x.Id == id);

            if (article == null)
            {
                return(HttpNotFound());
            }
            return(View(article));
        }
        public ActionResult ArticleWholePage(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Article article = article_mngr.Find(x => x.Id == id);

            if (article == null)
            {
                return(HttpNotFound());
            }

            ViewBag.ArticleID = id;

            return(View("ArticleWholePage", article));
        }