Example #1
0
 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);
 }
Example #2
0
 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);
 }
Example #3
0
 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");
 }
Example #4
0
        public ActionResult Create(NewsCreate news)
        {
            if (!ModelState.IsValid)
                return View(news);

            INewsDAC dac = new NewsDAC();
            dac.Add(news.Subject, news.NewsText);
            return RedirectToAction("Index");
        }
Example #5
0
 public ActionResult Delete(int id)
 {
     INewsDAC dac = new NewsDAC();
     dac.Delete(id);
     return RedirectToAction("Index");
 }