Example #1
0
        public async Task <IActionResult> All(int page = 1)
        {
            if (page <= 0)
            {
                return(this.NotFound());
            }

            var viewModel = new InquiriesViewModel
            {
                ItemsPerPage   = ItemsPerPage,
                CurrentPage    = page,
                InquiriesCount = await this.inquiriesService.GetCountAsync(),
                Inqueries      = await this.inquiriesService.GetAllAsync <IndexInquiryViewModel>(page, ItemsPerPage),
            };

            return(this.View(viewModel));
        }
Example #2
0
        public async Task <IActionResult> AllById(int page = 1)
        {
            if (page <= 0)
            {
                return(this.NotFound());
            }

            var claimsIdentity = (ClaimsIdentity)this.User.Identity;
            var claim          = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier);
            var userId         = claim.Value;

            var viewModel = new InquiriesViewModel
            {
                ItemsPerPage   = ItemsPerPage,
                CurrentPage    = page,
                InquiriesCount = await this.inquiriesService.GetCountAsync(userId),
                Inqueries      = await this.inquiriesService.GetAllAsync <IndexInquiryViewModel>(page, ItemsPerPage, userId),
            };

            return(this.View(viewModel));
        }