public ActionResult Index(AllSongsDTO filter) { filter.TakeEntity = 18; var songs = unitOfWork.SongService.GetAllSongs(filter); return(View(songs)); }
public AllSongsDTO GetAllSongs(AllSongsDTO filter) { var query = _songRepository.Get(null).AsQueryable(); var count = (int)Math.Ceiling(query.Count() / (double)filter.TakeEntity); var pager = Pager.Build(count, filter.PageId, filter.TakeEntity); var songs = query.OrderByDescending(s => s.Id).Paging(pager).ToList(); return(new AllSongsDTO().SetSongs(songs).SetPaging(pager)); }