Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("ID,GameID,Path,Content,Likes")] Article article)
        {
            if (ModelState.IsValid)
            {
                string key         = "QNm1VD6rhVk5uQO1lFE4xj3TK";
                string secret      = "wyrMxltWxebxRh0CpWpetfstsZvKCvtleQbM0ybuLkJ9pmIKlS";
                string token       = "392392197-2Tche78I2E0ambYnzoNTHlC58ohagMciJQ31uf33";
                string tokenSecret = "ODMVW5HsJho3te2XcSHdINGL3q0zPHR70PllOoOWUxq6O";

                var service = new TweetSharp.TwitterService(key, secret);
                service.AuthenticateWith(token, tokenSecret);

                var result = service.SendTweet(new SendTweetOptions
                {
                    Status = "Hey! Game Sense got a new Article for you gamers!\n come check it out!!"
                });


                _context.Add(article);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GameID"] = new SelectList(_context.Gamedb, "ID", "Name", article.GameID);
            return(View(article));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("ID,Name,ReleaseDate,Genre,ageRestriction,Developer,lat,lng,Description,Path,Views")] Game game)
        {
            if (ModelState.IsValid)
            {
                _context.Add(game);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(game));
        }