public ActionResult removeCartItem(int id) { try { TblCartItem cartItem = cartItemService.GetByPrimaryKey(id); if (cartItem != null) { TblCart cart = cartService.GetByPrimaryKey(cartItem.CartID); if (cart != null) { cartItemService.DeleteByPrimary(id); cartService.UpdateTotalPrice(cart.CartID); return(RedirectToAction("index", new { message = "delete1" })); } } return(RedirectToAction("index", new { message = "delete0" })); } catch (Exception ex) { LogService.WriteException(ex); throw; } }