예제 #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"));
            }
        }
예제 #2
0
        public sv_Product(pb_Product model)
        {
            ProductId   = model.ProductId;
            UserId      = model.UserId;
            Name        = model.Name;
            Price       = model.Price;
            HumanPrice  = model.HumanPrice();
            Description = model.Description;
            DateCreated = model.DateCreated;
            DateUpdated = model.DateUpdated;
            HumanCode   = model.HumanCode;
            Status      = model.Status;
            Views       = model.Views;

            Cover = new sv_Photo(model.CoverImage);

            bn_Photo bnPhoto = new bn_Photo();

            Photos = bnPhoto.GetByProductId(ProductId)
                     .Select(m => new sv_Photo(m))
                     .ToList();
        }
예제 #3
0
 public ps_Order()
 {
     Order   = new pb_Order();
     Product = new pb_Product();
 }