26 lines
656 B
C#
26 lines
656 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Portoa.Persistence;
|
|
using Portoa.Search;
|
|
|
|
namespace VideoGameQuotes.Web.Search {
|
|
public class SearchService<T> : ISearchService<T> where T : Entity<T, int> {
|
|
private readonly IRepository<T> repository;
|
|
|
|
public SearchService(IRepository<T> repository) {
|
|
this.repository = repository;
|
|
}
|
|
|
|
[UnitOfWork]
|
|
public IEnumerable<T> FindByIds(IEnumerable<int> ids) {
|
|
return repository
|
|
.Records
|
|
.Where(entity => ids.ToArray().Contains(entity.Id));
|
|
}
|
|
|
|
[UnitOfWork]
|
|
public IEnumerable<T> GetAllIndexableRecords() {
|
|
return repository.Records;
|
|
}
|
|
}
|
|
} |