예제 #1
0
        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();
            }
        }
예제 #2
0
        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();
            }
        }
예제 #3
0
        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();
            }
        }