Esempio n. 1
0
        public bool CreateAdmin()
        {
            var userCollection = jsonManager.GetCollection();

            if (!userCollection.Any(p => p.Name == "ADMIN" && p.LastName == "ADMIN" && p.Email == "ADMIN"))
            {
                try{
                    var adminUser = new User()
                    {
                        Name     = "ADMIN",
                        LastName = "ADMIN",
                        Email    = "ADMIN",
                        UserId   = Guid.NewGuid(),
                        PassWord = EncryptData.EncrypText("4dmin!"),
                    };
                    userCollection.Add(adminUser);

                    jsonManager.SaveCollection(userCollection);
                }
                catch {
                    return(false);
                }
                return(true);
            }
            return(true);
        }
Esempio n. 2
0
        public bool CreateDesk(Desk desk)
        {
            var deskCollection = jsonManager.GetCollection();

            deskCollection.Add(desk);

            jsonManager.SaveCollection(deskCollection);

            return(true);
        }