public void CreatePlayer(PlayerModel player) { if (Players.Count == 0) { //player.PlayersGrid.IsEnabled = true; player.IsWaiting = false; Players.Add(player); } else { //player.PlayersGrid.IsEnabled = false; player.IsWaiting = true; Players.Add(player); } }
// Подключение нового пользователя public void Connect(string userName) { var id = Context.ConnectionId; if (!Users.Any(x => x.connectionID == id)) { var p = new PlayerModel { connectionID = id, Login = userName }; Users.Add(p); // Посылаем сообщение текущему пользователю Clients.Caller.onConnected(id, userName, Users); // Посылаем сообщение всем пользователям, кроме текущего Clients.AllExcept(id).onNewUserConnected(id, userName); } }
public ActionResult Create(PlayerModel pl) { try { // TODO: Add insert logic here var player = new PlayerModel(); player.Login = pl.Login; context.Players.Add(player); context.SaveChanges(); return RedirectToAction("Info"); } catch { return View(); } }
public ActionResult Create(string name, int? id) { try { // TODO: Add insert logic here var player = new PlayerModel(); player.Login = name; player.ID = id.Value; players.Add(player); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult EditDetailes(PlayerModel player) { context.Entry(player).State = EntityState.Modified; context.SaveChanges(); return View(player); }