public async Task <GetAuthorAvatarByIdResponse> Handle(GetAuthorAvatarByIdRequest request)
 {
     return(new GetAuthorAvatarByIdResponse()
     {
         AuthorAvatar = AuthorAvatarApiModel.FromAuthorAvatar(await _dataContext.AuthorAvatars.FindAsync(request.Id))
     });
 }
示例#2
0
            public async Task <GetAuthorAvatarsResponse> Handle(GetAuthorAvatarsRequest request)
            {
                var authorAvatars = await _dataContext.AuthorAvatars.ToListAsync();

                return(new GetAuthorAvatarsResponse()
                {
                    AuthorAvatars = authorAvatars.Select(x => AuthorAvatarApiModel.FromAuthorAvatar(x)).ToList()
                });
            }
示例#3
0
        public static TModel FromAuthor <TModel>(Author author) where
        TModel : AuthorApiModel, new()
        {
            var model = new TModel();

            model.Id        = author.Id;
            model.Firstname = author.Firstname;
            model.Lastname  = author.Lastname;
            model.Avatar    = AuthorAvatarApiModel.FromAuthorAvatar(author.AuthorAvatar);
            return(model);
        }