예제 #1
0
        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());
        }
예제 #2
0
        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"));
        }