using System; using System.Collections.Generic; using System.Linq; using Portoa.Persistence; using Portoa.Search; namespace VideoGameQuotes.Web.Search { public class SearchService : ISearchService where T : IIdentifiable { private readonly IRepository repository; public SearchService(IRepository repository) { this.repository = repository; } [UnitOfWork] public IEnumerable FindByIds(IEnumerable ids) { return repository .Records .Where(entity => ids.ToArray().Contains(entity.Id)); } [UnitOfWork] public IEnumerable GetAllIndexableRecords() { return repository.Records; } public TId ConvertIdFromStringValue(string idValue) { return (TId)Convert.ChangeType(idValue, typeof(TId)); } } }