public IActionResult AllByTag(SearchByTagInputModel input) { AllCoursesListViewModel viewModel = new AllCoursesListViewModel { Courses = this.coursesService.GetAllByTag <AllCoursesViewModel>(input), }; return(this.View(viewModel)); }
public IEnumerable <T> GetAllByTag <T>(SearchByTagInputModel input) { return(this.coursesRepository .All() .OrderByDescending(c => c.StartDate) .Where(c => c.Tags.Any(t => t.Tag.Name == input.Name) && c.IsApproved.Value) .To <T>() .ToList()); }