Пример #1
0
        public async Task <Redmine.Models.Types.User> GetCurrentUserAsync()
        {
            var config      = new MapperConfiguration(cfg => cfg.CreateMap <User, Redmine.Models.Types.User>());
            var redmineUser = await _redmineService.GetRedmineManager().GetCurrentUserAsync();

            CurrentUser = config.CreateMapper().Map <Redmine.Models.Types.User>(redmineUser);
            return(CurrentUser);
        }
Пример #2
0
        public async Task <PaginatedObjects <Project> > GetProjectsAsync()
        {
            var user = _userService.CurrentUser ?? await _userService.GetCurrentUserAsync();

            var parameters = new NameValueCollection
            {
                { Net.Api.RedmineKeys.LIMIT, 25.ToString(CultureInfo.InvariantCulture) },
                { Net.Api.RedmineKeys.OFFSET, 0.ToString(CultureInfo.InvariantCulture) }
            };
            var result = await _redmineService
                         .GetRedmineManager()
                         .GetPaginatedObjectsAsync <WebRedmine.Project>(parameters);

            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <WebRedmine.Project, Project>().ForMember(x => x.CustomFields, y => y.Ignore());
                cfg.CreateMap <WebRedmine.PaginatedObjects <WebRedmine.Project>, PaginatedObjects <Project> >();
            });

            return(config.CreateMapper().Map <PaginatedObjects <Project> >(result));
        }
Пример #3
0
        public async Task <PaginatedObjects <Issue> > GetIssuesAsync(int limit = 25, int offset = 0)
        {
            var user = _userService.CurrentUser ?? await _userService.GetCurrentUserAsync();

            var parameters = new NameValueCollection();

            parameters.Add(Net.Api.RedmineKeys.LIMIT, limit.ToString(CultureInfo.InvariantCulture));
            parameters.Add(Net.Api.RedmineKeys.OFFSET, offset.ToString(CultureInfo.InvariantCulture));

            var result = _redmineService.GetRedmineManager().GetPaginatedObjects <Net.Api.Types.Issue>(parameters);
            var config = new MapperConfiguration(cfg =>
                                                 cfg.CreateMap <WebRedmine.PaginatedObjects <WebRedmine.Issue>, PaginatedObjects <Issue> >());

            return(config.CreateMapper().Map <PaginatedObjects <Issue> >(result));
        }