本文整理汇总了C#中JMMServer.Repositories.AnimeSeriesRepository.GetMostRecentlyAdded方法的典型用法代码示例。如果您正苦于以下问题:C# AnimeSeriesRepository.GetMostRecentlyAdded方法的具体用法?C# AnimeSeriesRepository.GetMostRecentlyAdded怎么用?C# AnimeSeriesRepository.GetMostRecentlyAdded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JMMServer.Repositories.AnimeSeriesRepository
的用法示例。
在下文中一共展示了AnimeSeriesRepository.GetMostRecentlyAdded方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSeriesRecentlyAdded
public List<Contract_AnimeSeries> GetSeriesRecentlyAdded(int maxRecords, int jmmuserID)
{
List<Contract_AnimeSeries> retSeries = new List<Contract_AnimeSeries>();
try
{
using (var session = JMMService.SessionFactory.OpenSession())
{
JMMUserRepository repUsers = new JMMUserRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
JMMUser user = repUsers.GetByID(session, jmmuserID);
if (user == null) return retSeries;
List<AnimeSeries> series = repSeries.GetMostRecentlyAdded(session, maxRecords);
int numSeries = 0;
foreach (AnimeSeries ser in series)
{
if (user.AllowedSeries(ser))
{
Contract_AnimeSeries serContract = ser.ToContract(ser.GetUserRecord(session, jmmuserID));
if (serContract != null)
{
retSeries.Add(serContract);
numSeries++;
// Lets only return the specified amount
if (retSeries.Count == maxRecords) return retSeries;
}
}
}
}
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return retSeries;
}