public User GetOrCreateUser(string username)
        {
            using (var db = ConnectionFactory.Connect())
            {
                var user = db.SingleWhere<User>("Username", username);
                if (user == null)
                {

                    user = new User
                    {
                        Username = username,
                        UserId = GetUniqueId(),
                    };
                    logger.Info("Created new user '{0}'", username);

                    db.Save(user);
                }
                return user;
            }
        }
Exemplo n.º 2
0
 public User Get(User userRequest)
 {
     return Repository.GetUser(userRequest.UserId);
 }