public ActionResult Edit(int id) { if (Session["Login"] == null) { return(RedirectToAction("Index", "Home")); } Models.SongsDTO obj = Models.DBHelper.getSongByID(id); ViewBag.id = obj.SongID; ViewBag.singer = obj.Singer; ViewBag.name = obj.Name; return(View()); }
public ActionResult Delete(int id) { if (Session["Login"] == null) { return(RedirectToAction("Index", "Home")); } Models.SongsDTO obj = Models.DBHelper.getSongByID(id); ViewBag.link = obj.Link; String link = obj.Link; var path = Path.Combine(Server.MapPath("~/Content/songs"), link); FileInfo f = new FileInfo(path); f.Delete(); Models.DBHelper.deleteSong(id); return(View("Songs")); }