public ActionResult Delete(NewsBoard model) { try { NewsBoard theNews = work.NewsBoardRepository.GetByID(model.NewsBoardID); work.NewsBoardRepository.Delete(theNews); work.Save(); if (User.Identity.Name != "5000001") { // AuditTrail audit = new AuditTrail { Date = DateTime.Now, Action = "Deleted a news from the news Board", UserID = User.Identity.Name }; // work.AuditTrailRepository.Insert(audit); // work.Save(); } // TODO: Add delete logic here return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Create(NewsBoard model) { model.Date = DateTime.Now; try { if (ModelState.IsValid) { work.NewsBoardRepository.Insert(model); work.Save(); // TODO: Add insert logic here return RedirectToAction("Index"); } else { return View(model); } } catch { return View(); } }
public ActionResult Edit(NewsBoard model) { model.Date = DateTime.Now; try { if (ModelState.IsValid) { work.NewsBoardRepository.Update(model); work.Save(); if (User.Identity.Name != "5000001") { // AuditTrail audit = new AuditTrail { Date = DateTime.Now, Action = "Created a News on News Board", UserID = User.Identity.Name }; // work.AuditTrailRepository.Insert(audit); // work.Save(); } // TODO: Add update logic here return RedirectToAction("Index"); } else { return View(model); } } catch { return View(); } }