Beispiel #1
0
        public async Task <IActionResult> Index()
        {
            RatesViewModel ratesViewModel = new RatesViewModel();

            string userId = await GetCurrentUserIdAsync();

            List <PendingRate> userPendingRates = ratesRepository.GetPendingsForUser(userId).ToList();

            foreach (PendingRate pendingRate in userPendingRates)
            {
                ratesViewModel.ProductsToRate.Add(new ProductToRate
                {
                    Id = pendingRate.Product.Id, Name = pendingRate.Product.Name, DateOfPurchase = pendingRate.PurchaseDate
                });
            }

            ratesViewModel.GivenRates = ratesRepository
                                        .GetRatesGivenByUser(userId)
                                        .OrderByDescending(r => r.AddedDate)
                                        .ToList();

            return(View(ratesViewModel));
        }