Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("NameOfGameID,Name_of_Game,Game_description,GenreID")] NameOfGame nameOfGame)
        {
            if (id != nameOfGame.NameOfGameID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(nameOfGame);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NameOfGameExists(nameOfGame.NameOfGameID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GenreID"] = new SelectList(_context.Genres, "GenreID", "Genre_description", nameOfGame.GenreID);
            return(View(nameOfGame));
        }
        private void CheckWebAddress()
        {
            string      TempText       = null;
            String      DownloadString = "http://cyberterminators.co/details-v2.xml";
            XmlDocument XDocument      = new XmlDocument();

            try
            {
                XDocument.Load(DownloadString);
            }
            catch { return; }
            XmlElement  Root  = XDocument.DocumentElement;
            XmlNodeList Nodes = Root.SelectNodes("/megaT/HackList");

            foreach (XmlNode Node in Nodes)
            {
                TempText = Node.InnerText.ToLower();
            }

            foreach (string NameOfGame in TempText.Split(','))
            {
                if (Regex.Matches(NameOfGame, @"[a-zA-Z]").Count == 0)
                {
                    break;
                }
                else
                {
                    FreeHacks_Games_ComboBox.Items.Add(NameOfGame.TrimStart('\n'));
                }
            }
        }
Beispiel #3
0
        public async Task <IActionResult> Create([Bind("NameOfGameID,Name_of_Game,Game_description,GenreID")] NameOfGame nameOfGame)
        {
            if (ModelState.IsValid)
            {
                _context.Add(nameOfGame);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GenreID"] = new SelectList(_context.Genres, "GenreID", "Genre_name", nameOfGame.GenreID);
            return(View(nameOfGame));
        }