public ActionResult Save(ClientPerson client) { if (!ModelState.IsValid) { return(View("ClientDetails", client)); } if (client.Id == 0) { _context.ClientPersons.Add(client); } else { var existingClient = _context.ClientPersons.Single(c => c.Id == client.Id); existingClient.FirstName = client.FirstName; existingClient.MiddleName = client.MiddleName; existingClient.LastName = client.LastName; existingClient.Address = client.Address; existingClient.IdCardNumber = client.IdCardNumber; existingClient.CitizenIdentityNumber = client.CitizenIdentityNumber; existingClient.Email = client.Email; existingClient.PhoneNumber = client.PhoneNumber; } _context.SaveChanges(); return(RedirectToAction("Index", "Clients")); }
void OnGUI() { if (!started) { ipAddress = GUI.TextField(new Rect(Screen.width / 2 - 150, Screen.height / 2 + 110, 300, 40), ipAddress); port = GUI.TextField(new Rect(Screen.width / 2 - 150, Screen.height / 2 + 160, 300, 40), port); if (GUI.Button(new Rect(Screen.width / 2 - 300, Screen.height / 2 + 120, 100, 20), "Start Server")) { // Server if (Input.GetKey(KeyCode.S)) { // This is NOT where you uncomment to run server on linux as OnGUI doesn't run there! StartServer(); // It'll be pretty obvious: Player.thisPlayer.team = 2; // Spectator (Never spawns.) PlayerInformation.steamName = "Test Server"; GameObject.Find("DeathCamera").GetComponent <Camera>().enabled = false; //ClassSelectionMenu.classSelectionMenuOpen = false; } else { StartServer(); } } if (GUI.Button(new Rect(Screen.width / 2 - 150, Screen.height / 2 + 60, 300, 40), "Connect")) { started = true; myClient = new ClientPerson(ipAddress, port); myClient.StartClient(); } else if (GUI.Button(new Rect(Screen.width / 2 - 300, Screen.height / 2 + 150, 100, 20), "Watch Demo")) { // This will fail on the frame it happens if no demo file: (Or it's too big?) if (File.Exists("TestDemo.dem")) { OperationNetwork.dataToReadIn = File.ReadAllBytes("TestDemo.dem"); } Debug.LogError("Watching Demo"); started = true; // timeStartedAt = Time.time; // Demo time is simply, "Time.time - timeStartedAt" currently. Basically, it reads the input data until time is after demoTime. OperationNetwork.isDemo = true; Player.myID = 32767; OperationNetwork.timeStartedAt = Time.time; OperationNetwork.currentByte = 0; // Implies maximum of 2gb. OperationNetwork.timeReceivedForDemo = false; // Demo watcher doesn't get a player. OptionsMenu.classSelectionMenuOpen = false; OptionsMenu.ChangeLockState(); } } }
public ActionResult New() { var newClient = new ClientPerson(); ViewBag.Title = "New"; return(View("ClientDetails", newClient)); }