예제 #1
0
        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);
        }
예제 #2
0
 private void Form1_Load(object sender, EventArgs e)
 {
     keys = new KeysGenerator();
 }