public Rules(RulesEditModel model) { CanTieMatch = model.CanTieMatch; MustWinGameByTwoPoints = model.MustWinGameByTwoPoints; GamesPerMatch = model.GamesPerMatch; GamesToWinMatch = model.GamesToWinMatch; Id = model.Id; PointsToWinGame = model.PointsToWinGame; PointsToWinTiebreaker = model.PointsToWinTiebreaker; Name = model.Name; }
public async Task <IActionResult> Create(RulesEditModel model) { if (!ModelState.IsValid) { return(View(model)); } var rules = new Rules(model); Db.Rules.Add(rules); await Db.SaveChangesAsync(); return(RedirectToAction("Index")); }