Exemple #1
0
        public ActionResult Edit(Guid productId)
        {
            bn_Product bnProduct = new bn_Product();
            pb_Product product   = bnProduct.GetById(productId);

            if (product != null)
            {
                bn_Photo         bnPhoto      = new bn_Photo();
                bn_ProductTag    bnProductTag = new bn_ProductTag(productId);
                ps_ProductCreate model        = new ps_ProductCreate();

                var photoList = bnPhoto.GetByProductId(productId);
                List <ps_ProductPhoto> photos = new List <ps_ProductPhoto>();
                foreach (var item in photoList)
                {
                    photos.Add(new ps_ProductPhoto {
                        PhotoId   = item.PhotoId,
                        PhotoPath = item.ImagePath
                    });
                }

                model.Product             = product;
                model.Product.Description = HttpUtility.HtmlDecode(model.Product.Description);
                model.Tags          = bnProductTag.GetTagedList();
                model.ProductPhotos = photos;
                Session["Photos"]   = new List <ps_ProductPhoto>();
                return(View(model));
            }
            else
            {
                //redirect to error page
                return(RedirectToAction("Error404", "Error"));
            }
        }
Exemple #2
0
        //[Authorize]
        public ActionResult Detail(Guid productId)
        {
            bn_Product bnProduct = new bn_Product();
            var        model     = bnProduct.GetById(productId);

            bnProduct.IncrViews(model.ProductId);

            return(View(model));
        }
Exemple #3
0
        public ActionResult New(Guid productId)
        {
            bn_Product bnProduct = new bn_Product();
            ps_Order   model     = new ps_Order();

            var user    = ps_Membership.GetUser();
            var product = bnProduct.GetById(productId);

            if (user != null)
            {
                //add some default values.
                model.Order.UserId       = user.UserId;
                model.Order.CustomerName = user.FullName;
            }

            model.Order.Price = (product.DiscountPrice.HasValue) ?
                                product.DiscountPrice.Value :
                                product.Price;
            model.Order.Amount    = 1;
            model.Order.ProductId = productId;
            model.Product         = product;

            return(View(model));
        }