Created
November 6, 2018 02:54
-
-
Save jasongaylord/1dde496f0df23ffc3f06664c0914a40d to your computer and use it in GitHub Desktop.
Part of the https://gist.github.com/jasongaylord/df33fe4cd4bc7d253a10c3cdccc41104#file-default-cshtml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RetrieveTweetsViewComponent : ViewComponent | |
{ | |
protected TwitterOptions TwitterOptions { get; private set; } | |
public RetrieveTweetsViewComponent(IOptions<TwitterOptions> options = null) | |
{ | |
if (options != null) | |
TwitterOptions = options.Value; | |
else | |
TwitterOptions = new TwitterOptions(); | |
} | |
public async Task<IViewComponentResult> InvokeAsync() | |
{ | |
var service = new TwitterService(); | |
var tweets = await service.RetrieveTweetsAsync(TwitterOptions); | |
return View("Default", tweets); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment