public IActionResult AddGamer(string name, int age, int hoursPlayed) { GamerModel newGamer = new GamerModel() { name = name, age = age, hoursPlayed = hoursPlayed }; _context.Add(newGamer); _context.SaveChanges(); return(View("ViewAll", _context)); }
public IActionResult DeleteGamer(int id, int hoursPlayed) { GamerModel matchingGamer = _context.gamers.FirstOrDefault(gamer => gamer.id == id); if (matchingGamer != null) { _context.Remove(matchingGamer); _context.SaveChanges(); return(View("ViewAll", _context)); } else { ViewData["gamerID"] = id; return(View("NotFound")); } }
public GamerService(EventService eventService) { this.eventService = eventService; model = Utils.Deserialize<GamerModel>(); }