public IActionResult AddToCart(int id) { try { var customer = JsonConvert.DeserializeObject <Models.Customer>(HttpContext.Session.GetString("CustomerSession")); // Debug.WriteLine("http:// Edit called"); CartItem.AddCartItem(customer.Id, id, _connection); Item.AddToCart(id, _connection); return(RedirectToAction("Index", "Home")); } catch (Exception e) { return(RedirectToAction("Index", "Customer1")); } }