示例#1
0
        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));
        }
示例#2
0
 // 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));
 }