public static bool InsertProductShoppingCart(ShoppingCartModel cart) { bool status = false; ProductCartManager productMgr = new ProductCartManager(); ShoppingCartDTO toReturn = new ShoppingCartDTO(); toReturn.ShoppingCartProductKId = cart.ShoppingCartProductKId; toReturn.ShoppingCartQuantity = cart.ShoppingCartQuantity; toReturn.ShoppingCartProductPrice = cart.ShoppingCartProductPrice; toReturn.ShoppingCartId = cart.ShoppingCartId; //status = productMgr.InsertProductCart(toReturn); return status; }
public static ShoppingCartModel ToLocal(this ShoppingCartDTO productCart) { if (productCart != null) { ShoppingCartModel toReturn = new ShoppingCartModel(); toReturn.ProductCategoryName = productCart.ProductCategoryName; toReturn.ShoppingCartProductPrice = productCart.ShoppingCartProductPrice; toReturn.ShoppingCartQuantity = productCart.ShoppingCartQuantity; toReturn.ProductImageURL = productCart.ProductImageURL; toReturn.ShoppingCartId = productCart.ShoppingCartId; toReturn.ShoppingCartProductKId = productCart.ShoppingCartProductKId; return toReturn; } return null; }
public ActionResult ShoppingCart(ProductCartModel productCart) { ViewData["Data"] = null; ShoppingCartModel cart = new ShoppingCartModel(); cart.ShoppingCartProductPrice = Convert.ToDecimal(productCart.ProductCartPrice); cart.ShoppingCartProductKId = Convert.ToInt32(productCart.ProductCartProductKId); cart.ShoppingCartQuantity = Convert.ToInt32(productCart.ProductCartQuantity); cart.ShoppingCartId = GetShoppingCartId(); bool status = false; status = ShoppingCartService.InsertProductShoppingCart(cart); if (status) { ViewData["Data"] = ToJSON(ShoppingCartService.GetShoppingCartIteim(GetShoppingCartId())); ViewData["AddToCartItems"] = ShoppingCartService.CountShoppingCartItems(GetShoppingCartId()); } return View(); }