public IEnumerable <T> Search <T>(SongViewHistorySearchModels filter, string userId)
        {
            IQueryable <SongViewHistory> songViewHistories = this.context.SongViewHistories
                                                             .Where(s => s.UserId == userId);

            if (!string.IsNullOrEmpty(filter.Name))
            {
                songViewHistories = songViewHistories
                                    .Where(s => s.UserId == userId &&
                                           s.Song.Name.Contains(filter.Name));
            }

            return(songViewHistories.To <T>());
        }
Esempio n. 2
0
 public ActionResult <IEnumerable <SongViewModel> > Search(SongViewHistorySearchModels filter)
 => this.Ok(this.songViewHistoryService
            .Search <SongViewModel>(filter, this.userManager.GetUserId(this.User)));