static void DeleteNotice() { int noticeId; System.Console.WriteLine("Notice Id : "); int.TryParse(System.Console.ReadLine(), out noticeId); INoticeFacade noticeFacade = (INoticeFacade)FacadeFactory.Instance.Create(FacadeType.NoticeManagerFacade); OperationResult <bool> deleteNoticesRetValue = noticeFacade.DeleteNotice(noticeId); if (deleteNoticesRetValue.IsValid()) { System.Console.WriteLine("Notice Deleted!!"); } else { System.Console.WriteLine("Notice Not Deleted"); } }
public ActionResult DeleteNotice(int noticeId) { ActionResult retVal = null; INoticeFacade noticeFacade = (INoticeFacade)FacadeFactory.Instance.Create(FacadeType.NoticeManagerFacade); OperationResult <bool> result = noticeFacade.DeleteNotice(noticeId); if (result.IsValid()) { //retVal = RedirectToAction("GetActiveNotices", "Notice"); retVal = new JsonResult { Data = new { Message = "Notice deletely successfully", Success = true }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; } else if (result.HasFailed()) { //retVal = RedirectToAction("GetActiveNotices", "Notice"); retVal = new JsonResult { Data = new { Message = "Notice could not be deleted", Success = false }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; } else { retVal = View("~/Views/Shared/Error.cshtml"); } return(retVal); }