public bool CreateUser(UserRegistrationModel user) { var dataBase = dBConnection.DataBase(); var newUser = SerializeUser(user); dataBase.Add(newUser); dataBase.Save(dBConnection.XmlPath()); return(true); }
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)))); }
public bool UserAlreadyExist(UserRegistrationModel user) { var users = GetAllUsersFromDataBase(); return(users.Contains(user.Login.Trim().ToLower())); }