예제 #1
0
        public ViewResult Create(int id)
        {
            ARTICLE article = new ARTICLE();

            article.FORUM_ID = id;

            return View(article);
        }
예제 #2
0
        public ActionResult Create(ARTICLE article)
        {
            if (ModelState.IsValid)
            {
                article.BUD_DTM = DateTime.Now;

                article.UPD_DTM = DateTime.Now;

                db.ARTICLE.Add(article);

                db.SaveChanges();

                return RedirectToAction("Index", new { id = article.FORUM_ID });
            }
            else
                return View();
        }
예제 #3
0
        public ActionResult Edit(ARTICLE article)
        {
            if (ModelState.IsValid)
            {
                article.BUD_DTM = DateTime.Now;

                article.UPD_DTM = DateTime.Now;

                TryUpdateModel(this.GetSingle(article.ID),
                    new string[] { "AUTHOR", "TITLE", "BODY", "BUD_DTM", "UPD_DTM" });

                db.SaveChanges();

                return RedirectToAction("Index", new { id = article.FORUM_ID });
            }
            else
                return View();
        }