public IHttpActionResult Register(ClientValue client) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var entity = _service.Register(client); if (entity == null) { return(BadRequest("Not registered.")); } return(CreatedAtRoute("DefaultApi", new { id = entity.Id }, entity)); }
/// <summary> /// Register new client. /// </summary> /// <param name="clientValue">Client basic properties</param> /// <returns>Client or null if client not created</returns> public Client Register(ClientValue clientValue) { if (clientValue == null) { return(null); } var oldClient = _repo.Clients.FirstOrDefault(i => i.Login == clientValue.Login); if (oldClient != null) { return(null); } var passwordHash = SecurePasswordHasher.Hash(clientValue.Password); var client = new Client(clientValue, passwordHash); return(_repo.Add(client)); }
private void OnDisable() { StartPlay -= StartPlayerAction; }
private void OnEnable() { StartPlay += StartPlayerAction; }