public ViewResult Create(int id) { ARTICLE article = new ARTICLE(); article.FORUM_ID = id; return View(article); }
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(); }
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(); }