예제 #1
0
        //Request.Cookies["userId"]["id"]
        // GET: AdminAlbum
        public ActionResult Index()
        {
            if ((Request.Cookies["userId"]["roleId"]) == "1")
            {
                var albums = db.Albums.ToList();

                AlbumsResponseVM albumsResponseVM = new AlbumsResponseVM()
                {
                    Albums = albums
                };

                return(View(albumsResponseVM));
            }

            return(RedirectToAction("Index", "Home"));
        }
예제 #2
0
        // GET: AdminAlbum/Details/id
        public ActionResult Details(int?id)
        {
            if ((Request.Cookies["userId"]["roleId"]) == "1")
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                Album album = db.Albums.Find(id);
                if (album == null)
                {
                    return(HttpNotFound());
                }

                AlbumsResponseVM albumResponseVM = new AlbumsResponseVM()
                {
                    Album  = album,
                    Musics = db.Musics.Where(a => a.Album.ID == album.ID).ToList()
                };
                return(View(albumResponseVM));
            }

            return(RedirectToAction("Index", "Home"));
        }