コード例 #1
0
        public ActionResult NoticePanel()
        {
            var repo    = new NoticeRepository(_context);
            var notices = repo.ListNotSeenNotices(_loggedUser.Id);
            var dateTimeHumanizerStrategy = new DefaultDateTimeHumanizeStrategy();

            return(PartialView("_NoticePanel", NoticeViewModel.FromEntityList(notices, dateTimeHumanizerStrategy)));
        }
コード例 #2
0
        public ActionResult ListNoticeHistory(DateTime?startDate, DateTime?endDate,
                                              NoticeType noticeType = NoticeType.All, int page = 1)
        {
            var range = new DateRange
            {
                StartDate = startDate,
                EndDate   = endDate
            };

            var historyService = new HistoryService(_context, new DefaultDateTimeHumanizeStrategy());

            return(Json(
                       NoticeViewModel.FromEntityList(historyService.SearchNotices(range, page, _loggedUser.Id, noticeType)),
                       JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        public ActionResult Index()
        {
            const NoticeType notivceType = NoticeType.Public;

            ViewBag.NoticeTypes = new SelectList(notivceType.ToDataSource <NoticeType>(), "Key", "Value");
            var range = new DateRange
            {
                StartDate = DateTime.Now.AddMonths(-1),
                EndDate   = DateTime.Now
            };
            var historyService = new HistoryService(_context, new DefaultDateTimeHumanizeStrategy());

            return(View(
                       NoticeViewModel.FromEntityList(historyService.SearchNotices(range, 1, _loggedUser.Id, NoticeType.All))));
        }