mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Add Find()
to BasicRepository
This commit is contained in:
@@ -16,6 +16,7 @@ namespace NzbDrone.Core.Datastore
|
||||
{
|
||||
IEnumerable<TModel> All();
|
||||
int Count();
|
||||
TModel Find(int id);
|
||||
TModel Get(int id);
|
||||
TModel Insert(TModel model);
|
||||
TModel Update(TModel model);
|
||||
@@ -87,10 +88,17 @@ namespace NzbDrone.Core.Datastore
|
||||
return Query(Builder());
|
||||
}
|
||||
|
||||
public TModel Get(int id)
|
||||
public TModel Find(int id)
|
||||
{
|
||||
var model = Query(x => x.Id == id).FirstOrDefault();
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
public TModel Get(int id)
|
||||
{
|
||||
var model = Find(id);
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
throw new ModelNotFoundException(typeof(TModel), id);
|
||||
|
Reference in New Issue
Block a user