public ActionResult DeleteConfirmed(int id) { //System.IO.File.Delete(Path.Combine(Server.MapPath("~/Content/Images/"), URL)); model.Foto fotodelete = new data.Foto().GetElement(id); if (System.IO.File.Exists(Path.Combine(Server.MapPath("~/Content/Images/"), fotodelete.URL))) { System.IO.File.Delete(Path.Combine(Server.MapPath("~/Content/Images/"), fotodelete.URL)); } new data.Foto().Delete(id); return(Redirect(Request.UrlReferrer.AbsolutePath)); }
// GET: /Foto/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } model.Foto foto = new data.Foto().GetElement(id.HasValue ? id.Value : 0); if (foto == null) { return(HttpNotFound()); } return(View(foto)); }