/// <summary> /// ajout un user /// </summary> /// <param name="user">le user</param> /// <returns>true si tout s'est bien passé</returns> public bool AddUser(User user) { if (!DaSingleton.GetInstance().ListUser.Any()) { DaSingleton.GetInstance().ListUser = data.CreateListUser(); } DaSingleton.GetInstance().ListUser.Add(user); return true; }
/// <summary> /// permet de connecter un user /// </summary> /// <param name="login">son login</param> /// <param name="pwd">son mot de passe</param> /// <returns>true si ca s'est bien passé sinon false ou une exception</returns> public bool Connect(string login, string pwd) { if (!DaSingleton.GetInstance().ListUser.Any()) { DaSingleton.GetInstance().ListUser = data.CreateListUser(); } try { Dbo.User tmpUser = DaSingleton.GetInstance().ListUser.Where(x => x.Login == login).FirstOrDefault(); if (tmpUser == null) { return(false); } else { tmpUser.Connected = tmpUser.Pwd == pwd; return(tmpUser.Pwd == pwd); } } catch (Exception ex) { throw new Exception("Exception Security ;)", ex); } }