// // GET: /Movie/Index public async Task <ActionResult> Index(string genreFilter, string mediumTypeFilter, string titleFilter) { HzgWebService svc = new HzgWebService(); List <ExtMovie> movies = new List <ExtMovie>(); if (string.IsNullOrEmpty(genreFilter) && string.IsNullOrEmpty(mediumTypeFilter) && string.IsNullOrEmpty(titleFilter)) { movies.AddRange(await svc.GetAllExtMoviesAsync()); } else if (!string.IsNullOrEmpty(titleFilter)) { movies.AddRange(await svc.GetMoviesByTitle(titleFilter, genreFilter, mediumTypeFilter)); } else if (!string.IsNullOrEmpty(genreFilter)) { movies.AddRange(await svc.GetExtMoviesByGenreIdAsync(new Guid(genreFilter))); } else if (!string.IsNullOrEmpty(mediumTypeFilter)) { movies.AddRange(await svc.GetExtMoviesByMediumTypeIdAsync(new Guid(mediumTypeFilter))); } var genres = await svc.GetAllGenres(); // ViewBag.Genres = new SelectList(genres.Select(g => g.GenreCd), genres.Select(g => g.Bezeichnung)); ViewBag.Genres = new List <SelectListItem>(genres.Select(g => new SelectListItem { Value = g.GenreId.ToString(), Text = g.GenreCd })); var mediumTypes = await svc.GetAllMediumTypes(); ViewBag.MediumTypes = new List <SelectListItem>(mediumTypes.Select(m => new SelectListItem { Value = m.MediumTypeId.ToString(), Text = m.Bezeichnung })); return(View(movies)); }
private async Task InitGenreMediumtypes(NewEditMovieModel model, HzgWebService svc) { /* Genre und Mediumtype Listen initialisieren */ var genres = await svc.GetAllGenres(); model.Genres.AddRange(genres.Select(g => new SelectListItem { Value = g.GenreId.ToString(), Text = g.GenreCd })); var mediumTypes = await svc.GetAllMediumTypes(); model.MediumTypes.AddRange(mediumTypes.Select(m => new SelectListItem { Value = m.MediumTypeId.ToString(), Text = m.Bezeichnung })); }