本文整理汇总了C#中IMediaService.GetPictureUrl方法的典型用法代码示例。如果您正苦于以下问题:C# IMediaService.GetPictureUrl方法的具体用法?C# IMediaService.GetPictureUrl怎么用?C# IMediaService.GetPictureUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMediaService
的用法示例。
在下文中一共展示了IMediaService.GetPictureUrl方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToModel
public static UserResponseModel ToModel(this User user, IMediaService mediaService, MediaSettings mediaSettings)
{
var model = new UserResponseModel()
{
Id = user.Id,
FirstName = user.FirstName,
LastName = user.LastName,
Name = user.Name,
DateCreatedUtc = user.DateCreated,
DateCreatedLocal = DateTimeHelper.GetDateInUserTimeZone(user.DateCreated, DateTimeKind.Utc, user),
UserName = user.UserName,
CoverImageUrl = mediaService.GetPictureUrl(user.GetPropertyValueAs<int>(PropertyNames.DefaultCoverId), PictureSizeNames.MediumCover),
ProfileImageUrl = mediaService.GetPictureUrl(user.GetPropertyValueAs<int>(PropertyNames.DefaultPictureId), PictureSizeNames.MediumProfileImage),
Active = user.Active
};
if (!string.IsNullOrEmpty(model.CoverImageUrl) && !string.IsNullOrEmpty(model.ProfileImageUrl))
return model;
if (string.IsNullOrEmpty(model.CoverImageUrl))
model.CoverImageUrl = mediaSettings.DefaultUserProfileCoverUrl;
if (string.IsNullOrEmpty(model.ProfileImageUrl))
model.ProfileImageUrl = mediaSettings.DefaultUserProfileImageUrl;
return model;
}
示例2: ToPublicModel
public static SponsorPublicModel ToPublicModel(this Sponsor sponsor, IUserService userService, IMediaService pictureService, ISponsorService sponsorService, IFormatterService formatterService, MediaSettings mediaSettings)
{
var user = userService.Get(sponsor.UserId);
if (user == null)
return null;
//get sponsor data
var sponsorData = sponsorService.GetSponsorData(sponsor.BattleId, sponsor.BattleType, sponsor.UserId);
var model = new SponsorPublicModel
{
SponsorshipStatus = sponsor.SponsorshipStatus,
SponsorshipStatusName = sponsor.SponsorshipStatus.ToString(),
CustomerId = sponsor.UserId,
SeName = user.GetPermalink().ToString(),
SponsorName = user.GetPropertyValueAs<string>(PropertyNames.DisplayName),
SponsorProfileImageUrl =
pictureService.GetPictureUrl(user.GetPropertyValueAs<int>(PropertyNames.DefaultPictureId)),
SponsorshipAmount = sponsor.SponsorshipAmount,
SponsorshipAmountFormatted = formatterService.FormatCurrency(sponsor.SponsorshipAmount, ApplicationContext.Current.ActiveCurrency),
SponsorData = sponsorData.ToModel(pictureService),
SponsorshipType = sponsor.SponsorshipType
};
return model;
}
示例3: ToEntityModel
public static UserEntityModel ToEntityModel(this User user, IMediaService mediaService, MediaSettings mediaSettings)
{
var userCoverId = user.GetPropertyValueAs<int>(PropertyNames.DefaultCoverId);
var userProfileImageId = user.GetPropertyValueAs<int>(PropertyNames.DefaultPictureId);
var model = new UserEntityModel() {
Id = user.Id,
FirstName = user.FirstName,
LastName = user.LastName,
Name = user.Name,
UserName = user.UserName,
Email = user.Email,
Active = user.Active,
Remarks = user.Remarks,
RoleIds = user.UserRoles.Select(x => x.RoleId).ToList(),
LastLoginDateUtc = user.LastLoginDate,
LastLoginDateLocal = DateTimeHelper.GetDateInUserTimeZone(user.LastLoginDate, DateTimeKind.Utc, user),
CoverImageId = userCoverId,
ProfileImageId = userProfileImageId
};
model.CoverImageUrl = userCoverId == 0 ? mediaSettings.DefaultUserProfileCoverUrl : mediaService.GetPictureUrl(userCoverId, PictureSizeNames.MediumCover);
model.ProfileImageUrl = userProfileImageId == 0 ? mediaSettings.DefaultUserProfileImageUrl : mediaService.GetPictureUrl(userProfileImageId, PictureSizeNames.MediumProfileImage);
return model;
}
示例4: ToModel
public static SponsorDataModel ToModel(this SponsorData sponsorData, IMediaService mediaService)
{
if (sponsorData == null)
return new SponsorDataModel();
var model = new SponsorDataModel()
{
Id = sponsorData.Id,
BattleType = sponsorData.BattleType,
BattleId = sponsorData.BattleId,
SponsorCustomerId = sponsorData.SponsorCustomerId,
PictureId = sponsorData.PictureId,
DisplayName = sponsorData.DisplayName,
TargetUrl = sponsorData.TargetUrl,
DisplayOrder = sponsorData.DisplayOrder
};
if (sponsorData.PictureId > 0)
model.PictureUrl = mediaService.GetPictureUrl(model.PictureId);
return model;
}