added /logs

This commit is contained in:
Keivan Beigi 2013-06-04 17:49:53 -07:00
commit 9160343a51
16 changed files with 231 additions and 16 deletions

View file

@ -31,6 +31,7 @@ namespace NzbDrone.Core.Datastore
void DeleteMany(IEnumerable<int> ids);
void SetFields(TModel model, params Expression<Func<TModel, object>>[] properties);
TModel Single();
PagingSpec<TModel> GetPaged(PagingSpec<TModel> pagingSpec);
}
@ -198,6 +199,21 @@ namespace NzbDrone.Core.Datastore
}
public virtual PagingSpec<TModel> GetPaged(PagingSpec<TModel> pagingSpec)
{
var pagingQuery = Query.OrderBy(pagingSpec.OrderByClause(), pagingSpec.ToSortDirection())
.Skip(pagingSpec.PagingOffset())
.Take(pagingSpec.PageSize);
pagingSpec.Records = pagingQuery.ToList();
//TODO: Use the same query for count and records
pagingSpec.TotalRecords = Count();
return pagingSpec;
}
private void PublishModelEvent(TModel model, RepositoryAction action)
{
if (PublishModelEvents)