Esempio n. 1
0
 public ActionResult Edit(PopsModel dados)
 {
     if (ModelState.IsValid)
     {
         pops.update(dados);
         return(RedirectToAction("index"));
     }
     return(View(dados));
 }
Esempio n. 2
0
        public ActionResult Create(PopsModel novo, HttpPostedFileBase image)
        {
            if (ModelState.IsValid)
            {
                if (image == null)
                {
                    ModelState.AddModelError("", "You can see the pop right? Take a picture of it");
                    return(View(novo));
                }
                int id = pops.create(novo);

                string filepath = Server.MapPath("~/Content/Pops/") + id + ".jpg";
                image.SaveAs(filepath);


                return(RedirectToAction("index"));
            }
            return(View(novo));
        }