Ejemplo n.º 1
0
        public ActionResult ImageView()
        {
            ImageBusinessLayer imageBusinessLayer = new ImageBusinessLayer();
            List <Image>       images             = imageBusinessLayer.Images.ToList();

            return(View(images));
        }
Ejemplo n.º 2
0
        public ActionResult Delete(int id)
        {
            ImageBusinessLayer imageBusinessLayer =
                new ImageBusinessLayer();

            imageBusinessLayer.DeleteImage(id);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
        public ActionResult Edit(int id)
        {
            ImageBusinessLayer imageBusinessLayer =
                new ImageBusinessLayer();
            Image image =
                imageBusinessLayer.Images.Single(emp => emp.UserId == id);

            return(View(image));
        }
Ejemplo n.º 4
0
        public ActionResult Edit(Image image)
        {
            if (ModelState.IsValid)
            {
                ImageBusinessLayer imageBusinessLayer =
                    new ImageBusinessLayer();
                imageBusinessLayer.SaveImage(image);

                return(RedirectToAction("Index"));
            }
            return(View(image));
        }
Ejemplo n.º 5
0
        public ActionResult Create(Image image)
        {
            if (ModelState.IsValid)
            {
                string filename  = Path.GetFileNameWithoutExtension(image.imagefile.FileName);
                string extension = Path.GetExtension(image.imagefile.FileName);
                filename        = filename + DateTime.Now.ToString("yymmssfff") + extension;
                image.imagepath = "~/pictures/" + filename;
                filename        = Path.Combine(Server.MapPath("~/pictures"), filename);
                image.imagefile.SaveAs(filename);

                // Retrieve form data using form collection
                ImageBusinessLayer imageBusinessLayer =
                    new ImageBusinessLayer();

                imageBusinessLayer.AddImage(image);
                return(RedirectToAction("Index"));
            }
            return(View(image));
        }