public TweetsController(ITweetService _tweetService, IUserService _userService) { this._tweetService = _tweetService; this._userService = _userService; this._context = new TwitterSharpContext(); }
public async Task PostTweet(Tweet tweet, TwitterSharpContext ctx) { ctx.Tweets.Add(tweet); await ctx.SaveChangesAsync(); if (tweet.User == null) { } }
public async Task DeleteTweet(Tweet tweet, TwitterSharpContext ctx) { ctx.Tweets.Remove(tweet); await ctx.SaveChangesAsync(); }
public Task <ApplicationUser> GetUserByName(string username, TwitterSharpContext ctx) { return(ctx.Users.FirstOrDefaultAsync(u => u.UserName == username)); }