public async Task <ActionResult> DeleteConfirmed(int id) { FotoPois fotoPois = await db.FotoPois.FindAsync(id); db.FotoPois.Remove(fotoPois); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "ID,PoiID,Caminho,GPS_Lat,GPS_Long,Aprovado")] FotoPois fotoPois) { if (ModelState.IsValid) { db.Entry(fotoPois).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.PoiID = new SelectList(db.POIs, "ID", "Nome", fotoPois.PoiID); return(View(fotoPois)); }
// GET: FotoPois/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FotoPois fotoPois = await db.FotoPois.FindAsync(id); if (fotoPois == null) { return(HttpNotFound()); } return(View(fotoPois)); }
// GET: FotoPois/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FotoPois fotoPois = await db.FotoPois.FindAsync(id); if (fotoPois == null) { return(HttpNotFound()); } ViewBag.PoiID = new SelectList(db.POIs, "ID", "Nome", fotoPois.PoiID); return(View(fotoPois)); }
public async Task <ActionResult> Create([Bind(Include = "ID,PoiID,Caminho,GPS_Lat,GPS_Long,Aprovado")] FotoPois fotoPois, HttpPostedFileBase File) { if (ModelState.IsValid) { if (File != null && File.ContentLength > 0) { string _FileName = Path.GetFileName(File.FileName); // store the file inside ~/Foto folder string _path = Path.Combine(Server.MapPath("~/Foto"), _FileName); File.SaveAs(_path); string caminho = "Foto/" + _FileName; fotoPois.Caminho = caminho; } db.FotoPois.Add(fotoPois); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.PoiID = new SelectList(db.POIs, "ID", "Nome", fotoPois.PoiID); return(View(fotoPois)); }