Пример #1
0
        public ActionResult Search(string searchBy, string searchType)
        {
            var database = new FakeFilmDatabase();

            IEnumerable <Film> results;

            if (searchType == "Title")
            {
                results = database.GetAll().Where(m => m.Title.Contains(searchBy));
                return(View("IndexSearch", results));
            }

            if (searchType == "Director")
            {
                results = database.GetAll().Where(m => m.Director.Contains(searchBy));
                return(View("IndexSearch", results));
            }

            if (searchType == "Actors")
            {
                results = database.GetAll().Where(m => m.Actor.Contains(searchBy));
                return(View("IndexSearch", results));
            }

            return(View("Index", database.GetAll()));
        }
Пример #2
0
        public ActionResult Details(int id)
        {
            var  database = new FakeFilmDatabase();
            Film film     = database.GetById(id);

            return(View("Details", film));
        }
Пример #3
0
        public ActionResult EditFilm(Film c)
        {
            var database = new FakeFilmDatabase();



            return(RedirectToAction("Index"));
        }
Пример #4
0
        public ActionResult Edit(int id)
        {
            //int filmId = int.Parse(RouteData.Values["id"].ToString());

            var database = new FakeFilmDatabase();
            var film     = database.GetById(id);

            return(View(film));
        }
Пример #5
0
        public ActionResult DeleteFilm()
        {
            int filmId = int.Parse(Request.Form["FilmId"]);

            var database = new FakeFilmDatabase();


            var films = database.GetAll();

            return(View("Index", films));
        }