You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ombi/src/Ombi.Mapping/MappingConverters.cs

41 lines
997 B

using AutoMapper;
using System;
using System.Security.Claims;
using Ombi.Core.Models.UI;
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);
}
}
public class ClaimsConverter : ITypeConverter<Claim, ClaimCheckboxes>
{
public ClaimCheckboxes Convert(Claim source, ClaimCheckboxes destination, ResolutionContext context)
{
return new ClaimCheckboxes
{
Enabled = true,
Value = source.Value
};
}
}
}