示例#1
0
        public bool CreateUser(UserRegistrationModel user)
        {
            var dataBase = dBConnection.DataBase();
            var newUser  = SerializeUser(user);

            dataBase.Add(newUser);
            dataBase.Save(dBConnection.XmlPath());
            return(true);
        }
示例#2
0
        private XElement SerializeUser(UserRegistrationModel user)
        {
            Dictionary <string, string> userDictionary = new Dictionary <string, string>();

            userDictionary.Add("login", user.Login);
            userDictionary.Add("password", user.Password);
            userDictionary.Add("name", user.Name);

            return(new XElement("item", new XCData(JsonConvert.SerializeObject(userDictionary))));
        }
示例#3
0
        public bool UserAlreadyExist(UserRegistrationModel user)
        {
            var users = GetAllUsersFromDataBase();

            return(users.Contains(user.Login.Trim().ToLower()));
        }