Beispiel #1
0
        // DELETE: api/Tweets/5
        // [Authorize]
        // [ResponseType(typeof(Tweet))]
        public async Task <IHttpActionResult> DeleteTweet(int id)
        {
            Tweet tweet = await db.Tweets.FindAsync(id);

            if (tweet == null)
            {
                return(NotFound());
            }


            db.Tweets.Remove(tweet);
            await db.SaveChangesAsync();

            TweetViewModel tweetViewModel = new TweetViewModel(tweet);

            return(Ok(tweetViewModel.ToJsonFormat()));
        }