// PUT: api/Tweet/5 public void Post([FromBody] TweetViewModel tweet) { ApplicationUser user = userManager.FindById(User.Identity.GetUserId()); if (ModelState.IsValid && User.Identity.IsAuthenticated) { Twit twit_author = repo.FindTwitBasedOnApplicationUser(user); repo.AddTwitToDatabase(user); Tweet new_tweet = new Tweet { Message = tweet.Message, ImageURL = tweet.ImageURL, Author = twit_author, CreatedAt = DateTime.Now }; repo.AddTweet(new_tweet); } }
// POST: api/TwitUsername public void Post() { ApplicationUser user = userManager.FindById(User.Identity.GetUserId()); repo.AddTwitToDatabase(user); }