Ejemplo n.º 1
0
        public static TModel FromAuthorAvatar <TModel>(AuthorAvatar authorAvatar) where
        TModel : AuthorAvatarApiModel, new()
        {
            var model = new TModel();

            model.Id = authorAvatar.Id;
            return(model);
        }
        public static string GetImageLocalUrl(this AuthorAvatar avatar)
        {
            if (string.IsNullOrWhiteSpace(avatar.Name))
            {
                return(AppConstants.VirtualPaths.ImagePlaceholder.Substring(1));
            }

            var url = VirtualPathUtility.Combine(AppConstants.VirtualPaths.AuthorsContent, avatar.Name).Substring(1);

            return(url);
        }
Ejemplo n.º 3
0
            public async Task <AddOrUpdateAuthorAvatarResponse> Handle(AddOrUpdateAuthorAvatarRequest request)
            {
                var entity = await _dataContext.AuthorAvatars
                             .SingleOrDefaultAsync(x => x.Id == request.AuthorAvatar.Id && x.IsDeleted == false);

                if (entity == null)
                {
                    _dataContext.AuthorAvatars.Add(entity = new AuthorAvatar());
                }
                entity.Name = request.AuthorAvatar.Name;
                await _dataContext.SaveChangesAsync();

                return(new AddOrUpdateAuthorAvatarResponse()
                {
                });
            }
Ejemplo n.º 4
0
 public static AuthorAvatarApiModel FromAuthorAvatar(AuthorAvatar authorAvatar)
 => FromAuthorAvatar <AuthorAvatarApiModel>(authorAvatar);
Ejemplo n.º 5
0
 public Author()
 {
    Social = new Social();
    Badge = new AuthorBadge();
    Avatar = new AuthorAvatar();
 }
Ejemplo n.º 6
0
 public Author()
 {
     Social = new Social();
     Badge  = new AuthorBadge();
     Avatar = new AuthorAvatar();
 }