public ActionResult ProductImages(Guid id, HttpPostedFileBase file)
        {
            var image = new File();

            image.FileId = Guid.NewGuid();
            if (file != null)
            {
                image.Context = new byte[file.ContentLength];
                file.InputStream.Read(image.Context, 0, file.ContentLength);
                image.ContextType = file.ContentType;
                image.Title       = file.FileName;
            }

            db.File.Add(image);

            var extera = new ExtraImages()
            {
                ProductId     = id,
                FileId        = image.FileId,
                ExtraImagesId = Guid.NewGuid()
            };

            db.ExtraImages.Add(extera);
            db.SaveChanges();
            var list = new ExtraImagesBO().GetAll().Where(c => c.ProductId == id);

            ViewBag.ProductId = id;
            return(View(list));
        }
        public ActionResult ProductImages(Guid id)
        {
            if (SessionParameters.User == null)
            {
                return(Redirect("/Users/Login"));
            }
            var list = new ExtraImagesBO().GetAll().Where(c => c.ProductId == id);

            ViewBag.ProductId = id;
            return(View(list));
        }
Beispiel #3
0
        public ActionResult ProductDetails(Guid id)
        {
            var product    = new ProductBO().Get(id);
            var extraimage = new ExtraImagesBO().GetAll().Where(c => c.ProductId == id).ToList();

            product.ExtraImages = extraimage;
            ViewBag.Id          = product.ProductId;
            ViewBag.FileId      = product.FileId;


            return(PartialView("ProductDetails", product));
        }