public ActionResult Create() { var model = new HomeCreateRequestViewModel { StartedAt = DateTime.Now, PlayerO = UserName }; return View(model); }
public ActionResult Create(HomeCreateRequestViewModel model) { if (ModelState.IsValid) { var newGame = new TicTacToe { StartedAt = model.StartedAt ?? DateTime.Now, PlayerO = model.PlayerO }; newGame.Initialize(model.Size ?? 3); DB.Store(newGame); UserName = newGame.PlayerO; return RedirectToAction("Index"); } return View(); }