public IActionResult ShoppingCart() { List <OfferedLabourerService> serviceList = new List <OfferedLabourerService>(); //Check if we're logged in. bool loggedIn = SessionController.returnLoggedIn(this.HttpContext); if (!loggedIn) { //Not logged in, get products from cookies List <string> keyList = Request.Cookies.Keys.Where(k => k.StartsWith("SC")).ToList(); serviceList = Utility.CookieController.fetchItemsInCookies(keyList); } else { //Logged in, get products from database List <Object> offeredServiceIds = MollShopContext.GetShoppingCartItems((int)HttpContext.Session.GetInt32("UserId")); serviceList = new List <OfferedLabourerService>(); foreach (Object id in offeredServiceIds) { serviceList.Add(ElasticSearch.Queries.EsOLSQuery <object> .findByOfferedServiceId((int)id)); } } PayPalConfig payPalConfig = PayPalService.getPayPalConfig(); ViewBag.payPayConfig = payPalConfig; return(View(serviceList)); }