public ActionResult ProductDetail(string pid) { Session["MyprodcutID"] = pid; pid = _encryptionService.DecryptString2(pid); Product pro = new Product(); pro = Mapper.Map <Product>(_productservice.GetProductByID(Convert.ToInt32(pid))); return(View(pro)); }
public ActionResult Add(int?productID) { Product product = new Product(); if (productID != null) { product = Mapper.Map <Product>(_productservice.GetProductByID(Convert.ToInt32(productID))); var _res = _productservice.GetProductShoppingAllByProductID(Convert.ToInt32(productID)); int ProductPaidCount = 0; foreach (var res in _res) { ProductPaidCount += res.Quantity; } product.ProductPaidCount = ProductPaidCount; } return(View(product)); }
public JsonResult DeleteCartItem(int id, string cartType, int _productID) { if (cartType == GlobalConst.CartType.Product) { var _result = _shoppingeducationService.GetProductShoppingTempByID(id); if (_result != null) { if ((_result.ShippingPaymentID == null) && (_result.IsProcessed == null)) { _shoppingeducationService.DeleteProductShoppingCart(id); } else { if ((_result.ShippingPaymentID != null) && (_result.IsProcessed == null)) { Product _product = Mapper.Map <Product>(_productService.GetProductByID(_productID)); int deletedQty = _result.Quantity; _product.ProductCurrentBalance = _product.ProductCurrentBalance + deletedQty; _productService.UpdateProduct(Mapper.Map <HCRGUniversityApp.NEPService.ProductService.Product>(_product)); // Product Quantity ------ ProductQuantity _productQuantity = new ProductQuantity(); _productQuantity.ProdQuantity = deletedQty; _productQuantity.ProdQuantityDate = DateTime.Now; _productQuantity.ProductID = _productID; _productQuantity.UserID = HCRGUser.UID; _productQuantity.Mode = "Add-Deleted"; _productService.addProductQuantity(Mapper.Map <HCRGUniversityApp.NEPService.ProductService.ProductQuantity>(_productQuantity)); _shoppingeducationService.DeleteProductShoppingCart(id); } else { return(Json(GlobalConst.Message.CannotDeleted)); } } } else { return(Json(GlobalConst.Message.AlReadyDeletedSuccessfully)); } } else if (cartType == GlobalConst.CartType.AllAccessPass) { User _user = new User(); _user = Mapper.Map <User>(_userService.GetUserByID(HCRGUser.UID)); if (_user.IsAllAccessPricing.HasValue) { _user.IsAllAccessPricing = null; _userService.UpdateUser(Mapper.Map <HCRGUniversityApp.NEPService.UserService.User>(_user)); } } else { var _res = _shoppingeducationService.GetEducationShoppingTempByID(id); if (_res.ShippingPaymentID == null) { _shoppingeducationService.DeleteEducationFromShoppingCart(id); // online course deleted } else { return(Json(GlobalConst.Message.CannotDeleted)); } } return(Json(GlobalConst.Message.DeletedSuccessfully)); }