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)); }
public static SystemRequirement CreateNewSystemRequirementWithDefaults() { var systemRequirement = new SystemRequirement { MinimumColorQuality = string.Empty, MinimumPhysicalMemory = string.Empty, MinimumScreenResolution = string.Empty, MinimumWindowsInstallerVersion = string.Empty }; return systemRequirement; }
// 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)); }
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)); }