public ActionResult GetCurrentNotices()
        {
            ActionResult  retVal       = null;
            INoticeFacade noticeFacade = (INoticeFacade)FacadeFactory.Instance.Create(FacadeType.NoticeManagerFacade);
            OperationResult <IList <INoticeDTO> > result = noticeFacade.GetCurrentNotices();

            IList <NoticeModel> noticeModelList = null;

            if (result.IsValid())
            {
                noticeModelList = new List <NoticeModel>();
                NoticeModel noticeModel = null;
                foreach (INoticeDTO noticeDTO in result.Data)
                {
                    noticeModel = new NoticeModel();
                    DTOConverter.FillViewModelFromDTO(noticeModel, noticeDTO);
                    noticeModel.NotifierEmployeeName = noticeDTO.PostedByEmployee.FirstName + " " + noticeDTO.PostedByEmployee.LastName;
                    noticeModelList.Add(noticeModel);
                }
                retVal = View("~/Views/Notice/GetNotices.cshtml", noticeModelList);
            }
            else if (result.HasFailed())
            {
                retVal = RedirectToAction("Index", "Notice");
            }
            else
            {
                retVal = View("~/Views/Shared/Error.cshtml");
            }
            return(retVal);
        }
Example #2
0
        static void GetCurrentNotices()
        {
            INoticeFacade noticeFacade = (INoticeFacade)FacadeFactory.Instance.Create(FacadeType.NoticeManagerFacade);
            OperationResult <IList <INoticeDTO> > getNoticesRetValue = noticeFacade.GetCurrentNotices();

            if (getNoticesRetValue.IsValid())
            {
                foreach (var notice in getNoticesRetValue.Data)
                {
                    System.Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", notice.NoticeId, notice.Title, notice.Description, notice.PostedBy, notice.StartDate, notice.ExpirationDate);
                }
            }
        }