Exemple #1
0
        public ActionResult Details(int id)
        {
            GetSinglePicture(id);

            FindAllDVDs findDVDs = new FindAllDVDs();

            DVD SingleDVD = new DVD();

            if (id != null)
            {
                SingleDVD = findDVDs.GetDVDById(id);
            }
            return(View(SingleDVD));
        }
Exemple #2
0
        public ActionResult Index(string filterText, string movieGenre, string movieRating, string LastName)
        {
            //LoadRows();
            SearchGenre();
            SearchRating();
            GetAllPictures();



            FindAllDVDs findDVDs = new FindAllDVDs();
            IEnumerable <Data.Models.DVD> dvds = findDVDs.FindAllDVD("", "");
            var Results = dvds;

            if (string.IsNullOrWhiteSpace(filterText) == false)
            {
                //search on a specific term
                Results = dvds.Where(d => d.Title.ToLower().Contains(filterText));
            }

            //actorsearch

            if (!String.IsNullOrWhiteSpace(LastName))
            {
                Results = from d in db.DVDs
                          from a in d.Actors
                          where a.Last == LastName
                          select d;
            }


            //Results = from m in db.DVDs
            //             where m.Genre == movieGenre
            //             select m;

            if (!string.IsNullOrEmpty(movieGenre))
            {
                Results = dvds.Where(x => x.Genre == movieGenre);
            }

            if (!string.IsNullOrEmpty(movieRating))
            {
                Results = dvds.Where(x => x.Rating == movieRating);
            }



            return(View(Results.ToList()));
        }
        public ActionResult Index(string filterText, string movieGenre, string movieRating, string LastName)
        {
            // to upload the database comment-in the LoadRows() - in the Index()- and Run the ISS Express ONCE
            // it will then populate the database with images, actors, and dvds
            // then you must comment-out the LoadRows() before running ISS or doing any search
            // otherwise it will populate the database again



            //LoadRows();
            SearchGenre();
            SearchRating();
            GetAllPictures();

            FindAllDVDs findDVDs = new FindAllDVDs();
            IEnumerable <Data.Models.DVD> dvds = findDVDs.FindAllDVD("", "");
            var Results = dvds;

            if (string.IsNullOrWhiteSpace(filterText) == false)
            {
                //search on a specific term
                Results = Results.Where(d => d.Title.ToLower().Contains(filterText.ToLower()));
            }

            //actorsearch

            if (!String.IsNullOrWhiteSpace(LastName))
            {
                Results = from d in db.DVDs
                          from a in d.Actors
                          where a.Last == LastName
                          select d;
            }

            if (!string.IsNullOrEmpty(movieGenre))
            {
                Results = Results.Where(x => x.Genre == movieGenre);
            }

            if (!string.IsNullOrEmpty(movieRating))
            {
                Results = Results.Where(x => x.Rating == movieRating);
            }

            return(View(Results.ToList()));
        }