Пример #1
0
 public TweetsController(ITweetService _tweetService,
                         IUserService _userService)
 {
     this._tweetService = _tweetService;
     this._userService  = _userService;
     this._context      = new TwitterSharpContext();
 }
Пример #2
0
        public async Task PostTweet(Tweet tweet, TwitterSharpContext ctx)
        {
            ctx.Tweets.Add(tweet);
            await ctx.SaveChangesAsync();

            if (tweet.User == null)
            {
            }
        }
Пример #3
0
 public async Task DeleteTweet(Tweet tweet, TwitterSharpContext ctx)
 {
     ctx.Tweets.Remove(tweet);
     await ctx.SaveChangesAsync();
 }
Пример #4
0
 public Task <ApplicationUser> GetUserByName(string username, TwitterSharpContext ctx)
 {
     return(ctx.Users.FirstOrDefaultAsync(u => u.UserName == username));
 }