示例#1
0
        public ActionResult Index()
        {
            if (TempData["SignUpError"] != null)
            {
                IdentityResult identityResult = (IdentityResult)TempData["SignUpError"];
                if (identityResult != null)
                {
                    foreach (var error in identityResult.Errors)
                    {
                        string errorMessage = error;
                        if (error.ToLower().StartsWith("email") && error.EndsWith("is already taken"))
                        {
                            ViewData["PopupError"]        = true;
                            ViewData["PopupErrorMessage"] = "EmailTaken";
                        }
                    }
                }
            }

            if (TempData["ResponseResult"] != null)
            {
                ResponseResult <object> responseResult = (ResponseResult <object>)TempData["ResponseResult"];
                //ViewData["PopupError"] = responseResult.Success;
                //ViewData["PopupErrorMessage"] = responseResult.Message;
            }

            // Get string from strongly typed localzation resources
            var vm = new FullViewModel {
                LocalisedString = Strings.SomeLocalisedString
            };

            return(View(vm));

            // return View();
        }
示例#2
0
        public static List <FullViewModel> MatchListOfMwgvmWithOmdbEntrys(List <MovieWithGenreViewModel> MwG_list,
                                                                          MovieDbContext db)
        {
            //create complete view models based on MwGs
            List <FullViewModel> completeVm_list = new List <FullViewModel>();

            foreach (MovieWithGenreViewModel movieWithGenreViewModel in MwG_list)
            {
                //find the omdbEntry for the mwgvm that matches the title and year
                //TODO: fix omdb matching, for episodes
                var matching_oe =
                    db.Omdb.First(
                        item =>
                        item.title == movieWithGenreViewModel.movie.short_title &&
                        item.year == movieWithGenreViewModel.movie.year);

                //create a NITViewModel from the MwGVM and OmdbEntry
                var created_vm = new FullViewModel
                {
                    Movie =
                        movieWithGenreViewModel.movie,
                    Genres =
                        movieWithGenreViewModel
                        .genre_strings,
                    Boxarts   = movieWithGenreViewModel.boxart,
                    OmdbEntry = matching_oe
                };
                //add the viewmodel to the list to be returned to the view
                completeVm_list.Add(created_vm);
            }
            return(completeVm_list);
        }
示例#3
0
        public ActionResult LangFromRouteInActionFilter()
        {
            var vm = new FullViewModel {
                LocalisedString = Strings.SomeLocalisedString
            };

            return(View("Index", vm));
        }
示例#4
0
        public ActionResult CachedIndex()
        {
            var vm = new FullViewModel {
                LocalisedString = Strings.SomeLocalisedString
            };

            return(View("Index", vm));
        }
示例#5
0
        // Get language as a parameter from route data
        public ActionResult LangFromRouteValues(string lang)
        {
            Thread.CurrentThread.CurrentCulture   = CultureInfo.GetCultureInfo(lang);
            Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(lang);

            var vm = new FullViewModel {
                LocalisedString = Strings.SomeLocalisedString
            };

            return(View("Index", vm));
        }
示例#6
0
        // GET: Serie
        public async Task <IActionResult> Index(Guid?id, Guid?saisonId)
        {
            var viewModel = new FullViewModel();

            viewModel.SerieModel = _context.SerieModel
                                   .OrderBy(i => i.Name_serie);

            if (id != null)
            {
                ViewBag.SerieId       = id.Value;
                viewModel.SaisonModel = viewModel.SerieModel.Where(
                    i => i.ID == id.Value).Single().Saisons;
            }

            if (saisonId != null)
            {
                ViewBag.SaisonId       = saisonId.Value;
                viewModel.EpisodeModel = viewModel.SaisonModel.Where(
                    x => x.ID == saisonId.Value).Single().Episodes;
            }

            return(View(viewModel));
        }
        public ActionResult Details(int movie_ID = 0)
        {
            MovieDbContext db       = new MovieDbContext();
            FullViewModel  fullView = new FullViewModel();

            Movie movie = db.Movies.Find(movie_ID);

            if (movie == null)
            {
                return(View("Error"));
            }

            fullView.Movie     = movie;
            fullView.Genres    = PopulateFullView.Genres(movie_ID);
            fullView.Boxarts   = PopulateFullView.BoxArts(movie_ID);
            fullView.OmdbEntry = PopulateFullView.Omdb(movie_ID);
            fullView.Tags      = PopulateFullView.TagsAndCount(movie_ID);
            //added the plot to the fullView too, needs the whole movie, for the title and year
            fullView.Plot = PopulateFullView.Plot(movie);

            return(View(fullView));
            // return View("Details2", fullView);
        }