示例#1
0
        public async Task <bool> CheckProjectExistsAsync(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                throw new ArgumentNullException(nameof(id));
            }

            try
            {
                var project = await _client.Get <Project>(id, EmptyNameValueCollection);

                return(project != null);
            }
            catch (Exception ex)
            {
                throw new RedmineOperationException("unable to check project", ex);
            }
        }
        public static async Task <Dictionary <int, User> > GetUsersDictionary()
        {
            RedmineManager         redmineManager = new RedmineManager("https://task.powerbooks.xyz", "199aa0d8cfc78b5e668f487ca02c4c15f8e52f83");
            Dictionary <int, User> users          = new Dictionary <int, User>();

            for (int i = 0; i < 100; i++)
            {
                try
                {
                    users[i] = await redmineManager.Get <User>(i.ToString(), new NameValueCollection());
                }
                catch (Exception)
                {
                    users[i] = null;
                }
            }
            return(users);
        }