Beispiel #1
0
        public Session SignUp(Credential cr)
        {
            if (Exists(cr.Username))
            {
                return(null);
            }
            Repo <User> userRepo = new UserRepo();
            User        user     = new User(cr);

            userRepo.Create(user);
            Session        session     = new Session(user.Credential.Username, DateTime.MaxValue, LoginType.MAssenger, "A0-51-0B-BB-B8-3C");
            Repo <Session> sessionRepo = new SessionRepo();

            session = sessionRepo.Create(session);
            return(session);
        }
Beispiel #2
0
        public Session Login(Credential cr)
        {
            Repo <User>        ur    = new UserRepo();
            ICollection <User> ulist = ur.ReadAll();
            User user = null;

            foreach (var el in ulist)
            {
                if (el.Credential.Username == cr.Username && el.Credential.Password == cr.Password)
                {
                    user = el;
                }
            }
            if (user == null)
            {
                return(null);
            }
            Session        session     = new Session(user.Credential.Username, DateTime.MaxValue, LoginType.MAssenger, "A0-51-0B-BB-B8-3C");
            Repo <Session> sessionRepo = new SessionRepo();

            session = sessionRepo.Create(session);
            return(session);
        }