public Client AddClient(string clientName, bool isDevice)
        {
            if (this.dbContext.Clients.Any(c => c.ClientName == clientName))
            {
                return(null);
            }

            KeysGenerator keyGen = new KeysGenerator();

            var newClient = new Client()
            {
                ClientName  = clientName,
                IsDevice    = isDevice,
                IsDeveloper = !isDevice,
                ClientKey   = keyGen.GetNewKey()
            };

            this.dbContext.Clients.Add(newClient);
            this.dbContext.SaveChanges();
            return(newClient);
        }
Beispiel #2
0
 private void Form1_Load(object sender, EventArgs e)
 {
     keys = new KeysGenerator();
 }