示例#1
0
        public IActionResult Index()
        {
            IStarWarsDAO dao   = new MockStarWarsDAO();
            var          films = dao.GetFilms();

            return(View("Index", films));
        }
        public IActionResult Search(FilmSearch search)
        {
            // TODO: Show model binding into the FilmSearch object

            // If values were passed in, do a search. If not show the view with no model

            // TODO: Use ViewData to pass a "Message" into the view.
            // TODO: Add code to _Layout to look for that message.
            if (search == null || (search.SearchFor == null && search.Series == null))
            {
                ViewData["Message"] = "Please enter search criteria and press Search";
                return(View());
            }
            // Get List of films that match the search
            IStarWarsDAO dao = new MockStarWarsDAO();

            // TODO: Change this DAO to a SQL DAO to get the "production" data

            IList <Film> films = dao.GetFilms(search.SearchFor, search.Series);

            // TODO: If no films were returned, show a "Message" to the use that there were no search results.
            if (films.Count == 0)
            {
                ViewData["Message"] = "Your search produced no results. Please try again";
            }
            return(View(films));
        }
        public IActionResult Index()
        {
            // Get a list of all films (our Model)
            IStarWarsDAO dao   = new MockStarWarsDAO();
            IList <Film> films = dao.GetFilms();

            return(View(films));
        }
示例#4
0
        public IActionResult Detail(string id)
        {
            //get the film with the corresponding id and show the details
            IStarWarsDAO dao  = new MockStarWarsDAO();
            var          film = dao.GetFilm(id);

            return(View("Detail", film));
        }
示例#5
0
        public IActionResult Index()
        {
            // Instantiated the dao object
            IStarWarsDAO dao = new MockStarWarsDAO();
            // Asked the DAO to get me all the films and assign to the variable movies
            IList <Film> movies = dao.GetFilms();

            // Pass the variable movies into the razor engine to bind to the view
            return(View(movies));
        }
        public IActionResult Detail(string id)
        {
            // Find the film with the given id and display it in the default view
            IStarWarsDAO dao = new MockStarWarsDAO();

            // TODO: Change this DAO to a SQL DAO to get the "production" data

            Film film = dao.GetFilm(id);

            return(View(film));
        }
示例#7
0
        public IActionResult Details(string id)
        {
            // Create a DAO to access the "database"
            MockStarWarsDAO dao = new MockStarWarsDAO();

            // Call the mthod to get a single film
            Film film = dao.GetFilm(id);

            // Pass the film into the Details view
            return(View(film));
        }
示例#8
0
        public IActionResult Index()
        {
            var db = new MockStarWarsDAO();
            var vm = new FilmIndexViewModel();

            vm.Films = db.GetFilms();
            //vm.Age = 18;
            //vm.Height = 74;

            return(View(vm));
        }
示例#9
0
        public IActionResult Index()
        {
            // Get a list of all film
            MockStarWarsDAO dao   = new MockStarWarsDAO();
            IList <Film>    films = dao.GetFilms();

            // Pass the list of films into the View


            ViewResult viewResult = View(films);

            return(View(films));
        }
示例#10
0
        public IActionResult Detail(string id)
        {
            IStarWarsDAO dao  = new MockStarWarsDAO();
            Film         film = dao.GetFilm(id);

            if (film == null)
            {
                return(NotFound());
            }
            else
            {
                return(View(film));
            }
        }
示例#11
0
        public IActionResult Detail(string id)
        {
            // Find the film with the given id and display it in the default view
            IStarWarsDAO dao  = new MockStarWarsDAO();
            Film         film = dao.GetFilm(id);

            //if (film == null)
            //{
            //    return NotFound();
            //}
            //else
            //{
            return(View(film));
            //}
        }
示例#12
0
        // parameter name must match what's in startup.cs
        public IActionResult Detail(string movie_id)
        {
            IStarWarsDAO dao = new MockStarWarsDAO();

            if (!String.IsNullOrEmpty(movie_id))
            {
                Film movie = dao.GetFilm(movie_id);
                if (movie == null)
                {
                    return(NotFound());
                }
                return(View(movie));
            }
            else
            {
                return(NotFound());
            }
        }
示例#13
0
        public IActionResult Detail(string id)
        {
            IActionResult result = null;

            Film film = null;

            if (id != null)
            {
                var db = new MockStarWarsDAO();
                film   = db.GetFilm(id);
                result = View(film);
            }
            else
            {
                result = View("Error");
            }

            return(result);
        }