Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("SystemRequirementID,OS,Processor,Ram,Graphic,DirectX,Network,Storage")] SystemRequirement systemRequirement)
        {
            if (id != systemRequirement.SystemRequirementID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(systemRequirement);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SystemRequirementExists(systemRequirement.SystemRequirementID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SystemRequirementID"] = new SelectList(_context.Games, "ID", "ID", systemRequirement.SystemRequirementID);
            return(View(systemRequirement));
        }
Пример #2
0
 public static SystemRequirement CreateNewSystemRequirementWithDefaults()
 {
     var systemRequirement = new SystemRequirement
     {
         MinimumColorQuality = string.Empty,
         MinimumPhysicalMemory = string.Empty,
         MinimumScreenResolution = string.Empty,
         MinimumWindowsInstallerVersion = string.Empty
     };
     return systemRequirement;
 }
Пример #3
0
        // GET: Admin/SystemRequirements/Create
        public async Task <IActionResult> Create(int id)
        {
            ViewData["SystemRequirementID"] = new SelectList(_context.Games, "ID", "Gamename");
            var game = await _context.Games.Where(u => u.ID == id).FirstOrDefaultAsync();

            SystemRequirement sys = new SystemRequirement()
            {
                SystemRequirementID = game.ID
            };

            return(View(sys));
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("SystemRequirementID,OS,Processor,Ram,Graphic,DirectX,Network,Storage")] SystemRequirement systemRequirement)
        {
            if (ModelState.IsValid)
            {
                if (SystemRequirementExists(systemRequirement.SystemRequirementID) == false)
                {
                    _context.Add(systemRequirement);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
                else
                {
                    ViewData["SystemRequirementID"] = new SelectList(_context.Games, "ID", "Gamename", systemRequirement.SystemRequirementID);
                    return(View(systemRequirement));
                }
            }
            ViewData["SystemRequirementID"] = new SelectList(_context.Games, "ID", "Gamename", systemRequirement.SystemRequirementID);
            return(View(systemRequirement));
        }