コード例 #1
0
        public static List<FilmModel> GetFilter(SearchModel searchModel)
        {
            using (var db = new SaitContext())
            {
                var allFilms = DAO.WorkFilms.GetAllFilms();

                if (searchModel == null)
                {
                    return allFilms;
                }
                else
                {
                    var FilterSpisok = allFilms.Where(x => x.ChooseGenre == searchModel.genre).ToList();
                    if (searchModel.year > 0)
                    {
                        var our_year = new DateTime(searchModel.year, 1, 1);
                        FilterSpisok = FilterSpisok.Where(mod => mod.DataFilms > our_year).ToList();
                    }

                    return FilterSpisok;
                }
            }
        }
コード例 #2
0
 public ActionResult GetFilmsList(SearchModel searchModel)
 {
     return View(DAO.WorkFilms.GetFilter(searchModel));
 }