Sonarr/NzbDrone.Core/Datastore/Converters/UtcConverter.cs

33 lines
678 B
C#
Raw Normal View History

using System;
using Marr.Data.Converters;
using Marr.Data.Mapping;
namespace NzbDrone.Core.Datastore.Converters
{
public class UtcConverter : IConverter
{
public object FromDB(ColumnMap map, object dbValue)
{
return dbValue;
}
public object ToDB(object clrValue)
{
2013-06-10 02:10:15 +00:00
if (clrValue == DBNull.Value)
{
return clrValue;
}
var dateTime = (DateTime)clrValue;
return dateTime.ToUniversalTime();
}
public Type DbType
{
get
{
return typeof(DateTime);
}
}
}
}