Ejemplo n.º 1
0
        //height = 400
        public string ImageFixH1()
        {
            if (ImageH1 != null)
            {
                return(ImageH1);
            }
            else
            {
                try
                {
                    var desImage = Guid.NewGuid().ToString() + Path.GetExtension(ImagePath);
                    var result   = bn_Image.FixedHeight(
                        serverPath + ImagePath,
                        serverPath + desImage,
                        400);

                    if (result)
                    {
                        bn_Photo bnPhoto = new bn_Photo();
                        bnPhoto.UpdateImageH1(PhotoId, desImage);
                        return(desImage);
                    }
                    else
                    {
                        return(ImagePath);
                    }
                }
                catch (Exception ex)
                {
                    return(ImagePath);
                }
            }
        }
Ejemplo n.º 2
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"));
            }
        }
Ejemplo n.º 3
0
        private void Photo_UpdateProductId(Guid productId, List <ps_ProductPhoto> photos)
        {
            var bnPhoto = new bn_Photo();

            foreach (var item in photos)
            {
                bnPhoto.UpdateProductId(
                    item.PhotoId,
                    productId);
            }
        }
Ejemplo n.º 4
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();
        }