This is my method in User panel after click on Card Icon in header: as you see I read from data base some data. But I Have a script to handle and manage shop card ,
[HttpGet("/UserPanel/AddToCart")]
public async Task<IActionResult> ShowCart(List<int> chefFoodIds)
{
var userId = User.GetCurrentUserId();
if (chefFoodIds == null || !chefFoodIds.Any())
{
ViewBag.EmptyCartMessage = "You Don't Have any Item To Buy !";
}
await GetTax();
var cartItems = await _orderService.GetCartItemForShow(chefFoodIds);
ViewData["CartItemCount"] = cartItems.Sum(item => item.Quantity);
return View(cartItems);
}
I want to know If I want to create card and handle the price and quantity, can I do all of these needs without method on database in server side? I mean Can I do it with out database , Just in client side with local storage with java script?
If yes for having first data , to show in User Panel , it does not need to pickup data from data base in first? and can I do it from local storage too?
If yes , how can I handle the view of card and user panel in script?