Exemple #1
0
        public ActionResult Create(int showId, string showName)
        {
            var dbUserShows = db.GetUsersShows(USER_ID);
            var userShows   = new UserShowsViewModel()
            {
                UserId = dbUserShows.UserId
            };
            var showIds = new List <int>();

            foreach (var show in dbUserShows.UserShowsList)
            {
                userShows.UserShowsList.Add(new UserShow
                {
                    ShowId        = show.ShowId,
                    Name          = show.Name,
                    Season        = show.Season,
                    Episode       = show.Episode,
                    ShowEpisodeId = show.ShowEpisodeId
                });
                showIds.Add(show.ShowId);
            }

            if (showIds.Contains(showId))
            {
                return(RedirectToAction("Edit", new
                {
                    id = userShows.UserShowsList.Single(us => us.ShowId == showId).ShowEpisodeId,
                    name = showName
                }));
            }

            ViewBag.ShowId   = showId;
            ViewBag.ShowName = showName;
            return(View());
        }
Exemple #2
0
        // GET: ShowEpisodes
        public ActionResult Index()
        {
            var dbUserShows = db.GetUsersShows(USER_ID);
            var userShows   = new UserShowsViewModel()
            {
                UserId = dbUserShows.UserId
            };

            foreach (var show in dbUserShows.UserShowsList)
            {
                userShows.UserShowsList.Add(new UserShow
                {
                    ShowId        = show.ShowId,
                    Name          = show.Name,
                    Season        = show.Season,
                    Episode       = show.Episode,
                    ShowEpisodeId = show.ShowEpisodeId
                });
            }

            return(View(userShows));
        }