public ActionResult Details(int id)
        {
            WebNoticeViewModel model = new WebNoticeViewModel();

            model = WebNoticeBusiness.GetWebNoticebyId(id);
            return(View(model));
        }
 public ActionResult Create(WebNoticeViewModel model)
 {
     try
     {
         if (ModelState.IsValid && WebNoticeBusiness.IsAnyActiveWebNotice() <= 0)
         {
             int lastId = WebNoticeBusiness.LastNoticeId();
             model.NoticeId    = lastId + 1;
             model.UpdatedDate = DateTime.Now;
             WebNoticeBusiness.ApendWebNotice(model);
             return(RedirectToAction("Index"));
         }
         else
         {
             //ModelState.AddModelError("IsActive", "Already Active Notice is there, Make all other notice inactive.");
             ViewBag.ErrorMsg = "Already Active Notice is there, Make all other notice inactive and update this.";
             return(View(model));
         }
     }
     catch
     {
         //ModelState.AddModelError("IsActive", "Already Active Notice is there, Make all other notice inactive.");
         //return RedirectToAction("Create");
     }
     return(View(model));
 }
Exemple #3
0
        public ActionResult NoticeBoard()
        {
            string str = WebNoticeBusiness.DisplayNoticeBoard();

            if (!string.IsNullOrEmpty(str))
            {
                str = str.Replace(Environment.NewLine, "<br/>");
                ViewBag.NoticeBoard = str;
            }
            else
            {
                ViewBag.NoticeBoard = string.Empty;
            }
            return(View());
        }
 public ActionResult DeleteConformed(int id)
 {
     try
     {
         WebNoticeViewModel model = new WebNoticeViewModel();
         model = WebNoticeBusiness.GetWebNoticebyId(id);
         //model.NoticeId = 1013;
         WebNoticeBusiness.DeleteWebNotice(model);
         // TODO: Add delete logic here
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }