Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            ImageModell imageModell = db.ImageModells.Find(id);

            db.ImageModells.Remove(imageModell);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "ID,Name")] ImageModell imageModell)
 {
     if (ModelState.IsValid)
     {
         db.Entry(imageModell).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(imageModell));
 }
Exemplo n.º 3
0
        // GET: ImageModells/Edit/5
        public ActionResult Edit(Guid id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ImageModell imageModell = db.ImageModells.Find(id);

            if (imageModell == null)
            {
                return(HttpNotFound());
            }
            return(View(imageModell));
        }
Exemplo n.º 4
0
        public ActionResult Create(ImageModell img, HttpPostedFileBase file)
        {
            if (!ModelState.IsValid)
            {
                return(View(img));
            }
            if (file == null)
            {
                ModelState.AddModelError("Error", "No choosen file");

                return(View(img));
            }
            file.SaveAs(Path.Combine(Server.MapPath("~/Uploads"), file.FileName));
            return(RedirectToAction("Index"));
        }