public ActionResult Edit(PopsModel dados) { if (ModelState.IsValid) { pops.update(dados); return(RedirectToAction("index")); } return(View(dados)); }
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)); }