1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Core/Jobs/JobRepository.cs

41 lines
1.1 KiB
C#
Raw Normal View History

using System;
using System.Linq;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Messaging.Events;
2013-09-11 09:33:47 +03:00
2013-03-05 08:37:33 +03:00
namespace NzbDrone.Core.Jobs
{
public interface IScheduledTaskRepository : IBasicRepository<ScheduledTask>
{
ScheduledTask GetDefinition(Type type);
2013-05-11 02:53:50 +03:00
void SetLastExecutionTime(int id, DateTime executionTime);
}
public class ScheduledTaskRepository : BasicRepository<ScheduledTask>, IScheduledTaskRepository
{
public ScheduledTaskRepository(IDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator)
{
}
public ScheduledTask GetDefinition(Type type)
{
2013-05-11 02:53:50 +03:00
return Query.Single(c => c.TypeName == type.FullName);
}
2013-05-11 02:53:50 +03:00
public void SetLastExecutionTime(int id, DateTime executionTime)
{
var task = new ScheduledTask
{
Id = id,
LastExecution = executionTime
};
SetFields(task, scheduledTask => scheduledTask.LastExecution);
}
}
2013-03-25 06:51:32 +03:00
}