Example #1
0
        // GET: MyPosts
        public async Task <ActionResult> Index()
        {
            using (NoticeManager nm = new NoticeManager())
            {
                var user = await User.Identity.GetApplicationUserAsync();

                var approved = await nm.GetUserNoticesAsync(user.Id, 0, 6, Entities.Data.NoticeStatus.Approved);

                var pending = await nm.GetUserNoticesAsync(user.Id, 0, 6, Entities.Data.NoticeStatus.PendingApproval);

                var disapproved = await nm.GetUserNoticesAsync(user.Id, 0, 6, Entities.Data.NoticeStatus.Disapproved);

                MyPostViewModel pvm = new MyPostViewModel();

                foreach (var n in approved)
                {
                    pvm.ApprovedPosts.Add(NoticeMappings.To <DetailedNoticeViewModel>(n));
                }

                foreach (var n in pending)
                {
                    pvm.PendingPosts.Add(NoticeMappings.To <PendingNoticeViewModel>(n));
                }

                foreach (var n in disapproved)
                {
                    pvm.AmendedPosts.Add(NoticeMappings.To <AmendedNoticeViewModel>(n));
                }

                return(View(pvm));
            }
        }
Example #2
0
        // GET: /GetAmended?index=6&number=5
        public async Task <ActionResult> GetAmended(int?index, int?number)
        {
            using (NoticeManager nm = new NoticeManager())
            {
                int i    = index ?? 0;
                int n    = number ?? 5;
                var user = await User.Identity.GetApplicationUserAsync();

                var notices = await nm.GetUserNoticesAsync(user.Id, i, n, Entities.Data.NoticeStatus.Disapproved);

                List <AmendedNoticeViewModel> vm = new List <AmendedNoticeViewModel>();

                foreach (var notice in notices)
                {
                    vm.Add(NoticeMappings.To <AmendedNoticeViewModel>(notice));
                }

                return(View(vm));
            }
        }