Mapping mainly

This commit is contained in:
Jamie.Rees 2017-04-20 16:31:59 +01:00
parent 3f62d0d5ec
commit 41f03b46f1
20 changed files with 291 additions and 109 deletions

View file

@ -0,0 +1,26 @@
using AutoMapper;
using System;
namespace Ombi.Mapping
{
public class StringToDateTimeConverter : ITypeConverter<string, DateTime>
{
public DateTime Convert(string source, DateTime destination, ResolutionContext context)
{
DateTime dateTime;
if (string.IsNullOrEmpty(source))
{
return default(DateTime);
}
if (DateTime.TryParse(source.ToString(), out dateTime))
{
return dateTime;
}
return default(DateTime);
}
}
}