public async Task <GetAuthorAvatarByIdResponse> Handle(GetAuthorAvatarByIdRequest request) { return(new GetAuthorAvatarByIdResponse() { AuthorAvatar = AuthorAvatarApiModel.FromAuthorAvatar(await _dataContext.AuthorAvatars.FindAsync(request.Id)) }); }
public async Task <GetAuthorAvatarsResponse> Handle(GetAuthorAvatarsRequest request) { var authorAvatars = await _dataContext.AuthorAvatars.ToListAsync(); return(new GetAuthorAvatarsResponse() { AuthorAvatars = authorAvatars.Select(x => AuthorAvatarApiModel.FromAuthorAvatar(x)).ToList() }); }
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); }