Example #1
0
        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));
        }
Example #2
0
        /// <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));
        }
Example #3
0
 private void OnDisable()
 {
     StartPlay -= StartPlayerAction;
 }
Example #4
0
 private void OnEnable()
 {
     StartPlay += StartPlayerAction;
 }