mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-13 08:42:57 -07:00
The move!
This commit is contained in:
parent
1daf480b1b
commit
25526cc4d9
1147 changed files with 85 additions and 8524 deletions
41
src/Ombi.Mapping/MappingConverters.cs
Normal file
41
src/Ombi.Mapping/MappingConverters.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue