public async Task <IActionResult> AddToCartAsync(int userID, int itemID, string itemName, string itemSize, double price, string picLink, string addItemToCart) { int add; if (addItemToCart.Equals("Add To Cart")) { add = 1; ViewBag.Message = "Add To Cart Successfully!"; } else { add = -1; ViewBag.Message = "Remove From Cart Successfully!"; } CartInfo ci = new CartInfo(userID, itemID, itemName, itemSize, add, price, picLink); var baseUri = new Uri(urlString); var serverClient = new ServerClient(urlString); await serverClient.AddToItemAsync(ci); List <CartInfo> cartlist = await serverClient.GetMyCartAsync(userID); List <Item> list = await serverClient.GetItemsAsync(); ViewBag.User = login_user; //ViewBag.LinkableId = userID; //ViewBag.Double = balance; if (addItemToCart.Equals("Remove")) { String removeMessage = "Item " + itemID + " has been removed from user's cart successfully!"; Log log_itemAdd = new Log(userID, removeMessage); await serverClient.RecordLog(log_itemAdd); return(View("Cart", cartlist)); } else { String addMessage = "Item " + itemID + " has added to user's cart successfully!"; Log log_itemAdd = new Log(userID, addMessage); await serverClient.RecordLog(log_itemAdd); return(View("Homepage", list)); } //ViewData["Integer"] = userID; //return View("Success"); }