Esempio n. 1
0
 public TweetsController(ITweetService _tweetService,
                         IUserService _userService)
 {
     this._tweetService = _tweetService;
     this._userService  = _userService;
     this._context      = new TwitterSharpContext();
 }
Esempio n. 2
0
        public async Task PostTweet(Tweet tweet, TwitterSharpContext ctx)
        {
            ctx.Tweets.Add(tweet);
            await ctx.SaveChangesAsync();

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