//INSERT public bool commitInsert(news News) { using (objNews) { objNews.news.InsertOnSubmit(News); objNews.SubmitChanges(); return true; } }
public ActionResult NewsAdminDelete(int id, news News) { try { objNews.commitDelete(id); //IF DELETE = SUCCESS DISPLAY NEWS ADMIN INDEX return RedirectToAction("NewsAdminIndex"); } catch { return View(); } }
public ActionResult InsertNews(news News, HttpPostedFileBase file) { if (ModelState.IsValid) { if (file != null) { file.SaveAs(HttpContext.Server.MapPath("~/Content/news/") + file.FileName); News.news_img = file.FileName; } objNews.commitInsert(News); return RedirectToAction("NewsAdminIndex"); } return View(News); }
partial void Deletenews(news instance);
partial void Updatenews(news instance);
partial void Insertnews(news instance);
public ActionResult UpdateNews(int id, news News) { if (ModelState.IsValid) { try { objNews.commitUpdate(id, News.news_name, News.news_desc); return RedirectToAction("NewsAdminIndex"); } //IF ISSUE W. UPDATE DISPLAY UPDATE VIEW catch { return View(); } } return View(); }