本文整理汇总了C#中Subscriber.MapTo方法的典型用法代码示例。如果您正苦于以下问题:C# Subscriber.MapTo方法的具体用法?C# Subscriber.MapTo怎么用?C# Subscriber.MapTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subscriber
的用法示例。
在下文中一共展示了Subscriber.MapTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSubscriber
public Dtos.SubscribersDto GetSubscriber(Dtos.GetSubscribersInput input)
{
//Get the Subscriber(s)
//NOTE: If multiple subscribers come back than we need to filter based on subscribers associated to criteria for a company
//NOTE: May need to refactor by adding CompanyRefId to Subscriber
List<Subscriber> subscribers = new List<Subscriber>();
Subscriber subscriber = new Subscriber();
SubscribersDto subscriberDto = new SubscribersDto();
try
{
if (input.SubscribersEmail != string.Empty)
{
subscribers = _subscribersRepository.GetSubscriberByEmail(input.SubscribersEmail);
if (subscribers.Count > 1)
{
int subscriberId = 0;
foreach (var item in subscribers)
{
List<SubscriberCriteria> scList =
_subscribersValuesRepository.GetSubscribersCriteriaValues(item.Id, input.CompanyId.Value);
if (scList != null)
{
if (scList.Count > 0)
{
subscriberId = item.Id;
}
}
}
subscriber = subscribers.Where(s => s.Id == subscriberId).FirstOrDefault();
subscriberDto = subscriber.MapTo<SubscribersDto>();
}
else
{
subscriber = subscribers.FirstOrDefault();
subscriberDto = subscriber.MapTo<SubscribersDto>();
if (subscriber != null)
{
//Get subscriber images from DocumentHero
#region Get Subscriber Image
var inputFileExt = new List<FileExtDto>();
var inputFileExtValue = new FileExtDto()
{
Key = "SubscriberId",
Value = subscriber.Id.ToString(),
FileRefId = input.CompanyId.Value
};
inputFileExt.Add(inputFileExtValue);
GetFileInput fileInput = new GetFileInput();
fileInput.ApiKey = input.CompanyId;
fileInput.FileMetadata = inputFileExt;
//var _fileExtRepository = _iocResolver.Resolve<IFileExtRepository>();
//var fileService = IocManager.Instance.Resolve<FileAppService>();
//var imageUri = fileService.GetFiles(fileInput);
//DocumentHero.Files.FileAppService fileAppService = new FileAppService();
var resultsImage = _documentHeroService.GetAllByKeyValue(fileInput);
if (resultsImage.Files != null)
{
subscriberDto.ImageUri = resultsImage.Files[0].Uri;
}
}
#endregion
}
}
return subscriberDto;
}
catch(System.Exception exc)
{
Logger.ErrorFormat("CH_SAS_000", exc.StackTrace);
throw exc;
}
}