コード例 #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()
            }));
        }
コード例 #2
0
        public IActionResult Edit(int id)
        {
            var video = _videos.Get(id);

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

            return(View(video));
        }
コード例 #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()
            }));
        }
コード例 #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
            }
                        ));
        }
コード例 #5
0
        // 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()
            }

                       ));
        }
コード例 #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)
            }));
        }
コード例 #7
0
        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
            }));
        }
コード例 #8
0
        public void Delete(int id)
        {
            var contenido = _videoData.Get(id);

            _videoData.Delete(contenido);
        }