Exemplo n.º 1
0
        public IActionResult AllVideos(string searchString, int?pageNumber)
        {
            ViewData["CurrentFilter"] = searchString;
            var videos = string.IsNullOrEmpty(searchString) ? videoService.AllVideos()
                : videoService.VideosBySearch(searchString);

            return(View(PaginatedList <VideoViewModel> .Create(videos.AllVideos, pageNumber ?? 1, GlobalConstants.PageSize)));
        }
        //[HttpPost]
        //public async Task<IActionResult> AddVideo(VideoInputModel input, string userId)
        //{
        //    if (!ModelState.IsValid)
        //    {
        //        return this.View(input);
        //    }
        //    await videoService.AddVideoAsync(input.Link,input.Title,input.Description,userId);
        //    return Redirect("/Video/AllVideos");
        //}

        public IActionResult AllVideos(string search)
        {
            if (string.IsNullOrWhiteSpace(search))
            {
                return(this.View(videoService.AllVideos()));
            }
            return(this.View(videoService.VideosBySearch(search)));
        }