Exemple #1
0
        public IActionResult Details(int Id)
        {
            var model = videos.Get(Id);

            return(View(new VideoViewModel {
                Id = model.Id, Title = model.Title, Genre = model.Genre.ToString()
            }));
        }
        public IActionResult Edit(int id)
        {
            var video = _videos.Get(id);

            if (video == null)
            {
                return(RedirectToAction("index"));
            }

            return(View(video));
        }
Exemple #3
0
        public IActionResult Details(int id)
        {
            var model = _videos.Get(id);

            if (model == null)
            {
                return(RedirectToAction("Index"));
            }
            return(View(new VideoViewModel
            {
                Id = model.Id,
                Title = model.Title,
                Genre = model.Genre.ToString()
            }));
        }
Exemple #4
0
        public IActionResult Details(int id)
        {
            var model = _videos.Get(id);

            if (model == null)
            {
                return(RedirectToAction("Index"));
            }
            return(View(new VideoViewModel  // display ViewModel of the received video
            {
                Id = model.Id,
                Title = model.Title,
                Genre = model.Genre.ToString()     // take genre from the model (video entity), turn it into string
            }
                        ));
        }
        // Allows to search by Id parameter that will match a video id from the URL or the request data.
        // The Details view will display a single video in the browser, based on the id sent to the Details action
        public IActionResult Details(int id)
        {
            var model = _videos.Get(id);  //  Video Get(int id) from IVideoData

            // if wrong model id is entered page is redirected to index page
            if (model == null)
            {
                return(RedirectToAction("Index"));
            }
            return(View(
                       new VideoViewModel
            {
                Id = model.Id,
                Title = model.Title,
                Genre = model.Genre.ToString()
            }

                       ));
        }
Exemple #6
0
        public IActionResult Details(int id)
        {
            var model = _videos.Get(id);

            //return new ObjectResult(model);
            return(View(new VideoViewModel
            {
                Id = model.Id,
                Title = model.Title,
                Genre = Enum.GetName(typeof(Genres), model.GenreId)
            }));
        }
        public IActionResult Details(int id)
        {
            var model = _videos.Get(id);

            //  return new ObjectResult(model);


            if (model == null)
            {
                return(RedirectToAction("Index"));
            }
            return(View(new VideoViewModel
            {
                Id = model.Id,
                Title = model.Title,
                // Genre = Enum.GetName(typeof(Genres), model.Genre)
                Genre = model.Genre
            }));
        }
Exemple #8
0
        public void Delete(int id)
        {
            var contenido = _videoData.Get(id);

            _videoData.Delete(contenido);
        }