public async Task <IActionResult> Personal(int page = 1) { User user = await userManager.FindByNameAsync(User.Identity.Name); List <AuctionLot> userLots = new List <AuctionLot>(); int count = 0; if (await userManager.IsInRoleAsync(user, "regular user")) { userLots = await lotLogic.GetPage(page, new AuctionLot { User = user }); count = await lotLogic.GetCount(new AuctionLot { User = user }); } PersonalAccountViewModel model = new PersonalAccountViewModel { UserName = user.UserName, Email = user.Email, TelegramId = user.TelegramUsername, PersonalLotsList = new AuctionLotsViewModel { AuctionLots = userLots, PageViewModel = new PageViewModel(count, page, ApplicationConstantsProvider.GetPageSize()) } }; return(View(model)); }
public async Task <IActionResult> Lots(int page = 1) { List <AuctionLot> lotsOnModeration = await paginationLotLogic.GetPage(page, new AuctionLot { Status = LotStatusProvider.GetOnModerationStatus() }); int lotsCount = await paginationLotLogic.GetCount(new AuctionLot { Status = LotStatusProvider.GetOnModerationStatus() }); return(View(new AuctionLotsViewModel { AuctionLots = lotsOnModeration, PageViewModel = new PageViewModel(lotsCount, page, ApplicationConstantsProvider.GetPageSize()) })); }
public async Task <IActionResult> Lots(int page = 1) { List <AuctionLot> lotsToDisplay = await lotLogic.GetPage(page, new AuctionLot { Status = LotStatusProvider.GetAcceptedStatus() }); int lotsCount = await lotLogic.GetCount(new AuctionLot { Status = LotStatusProvider.GetAcceptedStatus() }); return(View(new AuctionLotsViewModel() { PageViewModel = new PageViewModel(lotsCount, page, ApplicationConstantsProvider.GetPageSize()), AuctionLots = lotsToDisplay })); }