public ActionResult Edit(int id) { INewsDAC dac = new NewsDAC(); var news = dac.Get(id); var model = new NewsEdit { DateCreated=news.DateCreated,NewsID=news.NewsID,NewsText=news.NewsText,Subject=news.Subject }; return View(model); }
public ActionResult Blog(int pageNo = 1, int pageSize = 6) { INewsDAC dac = new NewsDAC(); int totalNoRecords; int startIndex = pageSize * (pageNo - 1); var news = dac.Get(null, "DateCreated DESC", startIndex, pageSize, out totalNoRecords); return View(news); }
public ActionResult Edit(NewsEdit news) { if (!ModelState.IsValid) return View(news); INewsDAC dac = new NewsDAC(); dac.Update(news.NewsID, news.Subject, news.NewsText); return RedirectToAction("Index"); }
public ActionResult Create(NewsCreate news) { if (!ModelState.IsValid) return View(news); INewsDAC dac = new NewsDAC(); dac.Add(news.Subject, news.NewsText); return RedirectToAction("Index"); }
public ActionResult Delete(int id) { INewsDAC dac = new NewsDAC(); dac.Delete(id); return RedirectToAction("Index"); }