Ejemplo n.º 1
0
        public ActionResult Sil(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Link lnk = _managerLink.Find(x => x.ID == id.Value);

            if (lnk == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (System.IO.File.Exists(Server.MapPath("~/img/LinkLogo/" + lnk.LinkLogo)))
            {
                System.IO.File.Delete(Server.MapPath("~/img/LinkLogo/" + lnk.LinkLogo));
            }
            _managerLink.Delete(lnk);
            return(RedirectToAction("Index"));
        }