2022-02-15 11:52:43 +00:00
|
|
|
namespace ASC.Core;
|
2020-07-24 14:01:20 +00:00
|
|
|
|
2022-02-15 11:52:43 +00:00
|
|
|
[Serializable]
|
|
|
|
public class SubscriptionMethod : IMapFrom<DbSubscriptionMethod>
|
|
|
|
{
|
|
|
|
public int Tenant { get; set; }
|
|
|
|
public string Source { get; set; }
|
|
|
|
public string Action { get; set; }
|
|
|
|
public string Recipient { get; set; }
|
|
|
|
public string[] Methods { get; set; }
|
2019-07-22 12:31:09 +00:00
|
|
|
|
2022-02-15 11:52:43 +00:00
|
|
|
public static implicit operator SubscriptionMethod(SubscriptionMethodCache cache)
|
|
|
|
{
|
|
|
|
return new SubscriptionMethod()
|
2019-07-22 12:31:09 +00:00
|
|
|
{
|
2022-02-15 11:52:43 +00:00
|
|
|
Tenant = cache.Tenant,
|
|
|
|
Source = cache.SourceId,
|
|
|
|
Action = cache.ActionId,
|
|
|
|
Recipient = cache.RecipientId
|
|
|
|
};
|
|
|
|
}
|
2022-02-15 10:30:05 +00:00
|
|
|
|
2022-02-15 11:52:43 +00:00
|
|
|
public static implicit operator SubscriptionMethodCache(SubscriptionMethod cache)
|
|
|
|
{
|
|
|
|
return new SubscriptionMethodCache
|
2022-02-15 10:30:05 +00:00
|
|
|
{
|
2022-02-15 11:52:43 +00:00
|
|
|
Tenant = cache.Tenant,
|
|
|
|
SourceId = cache.Source,
|
|
|
|
ActionId = cache.Action,
|
|
|
|
RecipientId = cache.Recipient
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Mapping(Profile profile)
|
|
|
|
{
|
|
|
|
profile.CreateMap<DbSubscriptionMethod, SubscriptionMethod>()
|
|
|
|
.ForMember(dest => dest.Methods, opt => opt
|
|
|
|
.MapFrom(src => src.Sender.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)));
|
|
|
|
}
|
2019-05-15 14:56:09 +00:00
|
|
|
}
|