public async Task <ClientDto> RegisterClient(AddClientRequest addClientRequest)
        {
            string uri = "api/User/RegisterClient";

            var clientToDb = await httpServices.Post <ClientDto, AddClientRequest>(uri, addClientRequest);

            if (clientToDb == null)
            {
                throw new Exception("Sikertelen regisztráció");
            }

            return(clientToDb);
        }
        public ApiResponseMsg GetWorkItemsByQuery(string organizationName, string projectName)
        {
            Object wiql = new
            {
                query = "Select [Id],[State], [Title]" +
                        "From WorkItems " +
                        //"Where [Work Item Type] = '" + workItemType + "'" +
                        "Where [System.TeamProject] = '" + projectName + "' " +
                        "Order By [Stack Rank] Desc, [Backlog Priority] Desc"
            };

            HttpConfigurations oAppConfigurations = new HttpConfigurations();

            oAppConfigurations.BaseUrl   = _baseUrl;
            oAppConfigurations.UrlParams = string.Format("/{0}/_apis/wit/wiql?api-version=5.0", organizationName);

            oAppConfigurations.SecurityKey          = _token;
            oAppConfigurations.ContentType          = Constants.ContentTypeJson;
            oAppConfigurations.RequestBody          = JsonConvert.SerializeObject(wiql);
            oAppConfigurations.HttpMethod           = Constants.Post;
            oAppConfigurations.AuthenticationScheme = AuthConfig.AuthType;
            HttpServices oHttpService = new HttpServices(oAppConfigurations);

            return(oHttpService.Post());
        }
        public async Task <CurrencyDto> AddnewCurrency(string code, Nullable <bool> isDefault, string priceToDefault)
        {
            string uri = "api/currency/AddnewCurrency";

            var request = new CurrencyRequest
            {
                Code           = code,
                IsDefault      = isDefault,
                PriceToDefault = priceToDefault
            };

            var addNewCurrencyToDb = await httpServices.Post <CurrencyDto, CurrencyRequest>(uri, request);

            if (addNewCurrencyToDb == null)
            {
                throw new Exception("Sikertelen mentés!");
            }

            return(addNewCurrencyToDb);
        }
        public async Task <TeamDto> AddNewTeam(string TeamName, string publicPrice, string privatePrice, long currencyId,
                                               string userEmail)
        {
            string uri = "api/team/AddNewTeam";

            var request = new TeamRequest
            {
                Name         = TeamName,
                PublicPrice  = publicPrice,
                PrivatePrice = privatePrice,
                CurrencyId   = currencyId,
                UserEmail    = userEmail
            };

            var addNewTeamToDb = await httpServices.Post <TeamDto, TeamRequest>(uri, request);

            if (addNewTeamToDb == null)
            {
                throw new Exception("Nincs csapat!");
            }

            return(addNewTeamToDb);
        }
        private ApiResponseMsg GetAccessToken()
        {
            HttpConfigurations oAppConfigurations = new HttpConfigurations();

            oAppConfigurations.BaseUrl              = AuthConfig.AzureDevOpsBaseUrl;
            oAppConfigurations.UrlParams            = _tokenUrl;
            oAppConfigurations.ContentType          = Constants.ContentTypeUriEncode;
            oAppConfigurations.HttpMethod           = Constants.Post;
            oAppConfigurations.RequestBody          = GetTokenExchangeParam(_code);
            oAppConfigurations.AuthenticationScheme = Constants.ContentTypeUriEncode;
            HttpServices oHttpService = new HttpServices(oAppConfigurations);

            return(oHttpService.Post(true));
        }
Beispiel #6
0
        public async Task <ProjectDto> AddnewProject(string name, DateTime?deadline, Nullable <short> effortInHours, Nullable <decimal> effortInCurrency, long currencyId, long TeamId, long clientId)
        {
            string uri = "api/project/AddNewProject";

            var request = new ProjectRequest
            {
                Name             = name,
                DeadLine         = deadline,
                EffortInHours    = effortInHours,
                EffortInCurrency = effortInCurrency,
                TeamId           = TeamId,
                ClientId         = clientId,
                CurrencyId       = currencyId
            };

            var addNewProjectToDb = await httpServices.Post <ProjectDto, ProjectRequest>(uri, request);

            if (addNewProjectToDb == null)
            {
                throw new Exception("Sikertelen mentés");
            }

            return(addNewProjectToDb);
        }
Beispiel #7
0
        public async Task <RoleDto> AddRole(string key, RoleTypeEnum roleType)
        {
            string uri = "api/role/addrole";

            var request = new Rolerequest
            {
                Key        = key,
                RoleTypeId = roleType
            };

            var addRole = await httpServices.Post <RoleDto, Rolerequest>(uri, request);

            if (addRole == null)
            {
                throw new Exception(" Create role did not succesfull");
            }

            return(addRole);
        }
        public async Task <PermissionDto> AddPermission(long id, string key, PermissionTypeEnum permissionType)
        {
            string uri     = "api/permission/addpermission";
            var    request = new PermissionRequest
            {
                Id  = id,
                Key = key,
                PermissionTypeId = permissionType
            };

            var addPermissionToDb = await httpServices.Post <PermissionDto, PermissionRequest>(uri, request);

            if (addPermissionToDb == null)
            {
                throw new Exception("Save the new permission did not successful!");
            }

            return(addPermissionToDb);
        }
        public async Task <TodoDto> AddTodo(string title, string content, long projectId)
        {
            string uri = "api/todo/addtodo";

            var request = new TodoRequest
            {
                Content   = content,
                Title     = title,
                ProjectId = projectId
            };

            var addTodoToDb = await httpServices.Post <TodoDto, TodoRequest>(uri, request);

            if (addTodoToDb == null)
            {
                throw new Exception("Adding to the database was failed");
            }

            return(addTodoToDb);
        }
        public async Task <TimeRecordDto> AddTimeRecord(long id, string comment, int timeInSec, long todoId)
        {
            string uri = "api/timerecord/addtimerecord";

            var request = new TimeRecordRequest
            {
                Comment       = comment,
                TimeInSeconds = timeInSec,
                TodoId        = todoId
            };

            var timeRecord = await httpServices.Post <TimeRecordDto, TimeRecordRequest>(uri, request);

            if (timeRecord == null)
            {
                throw new Exception("Sikertelen mentés");
            }

            return(timeRecord);
        }
Beispiel #11
0
        public async Task <UserDto> Login(string email, string password)
        {
            string uri = "api/User/Login/";

            var request = new LoginRequest
            {
                Email    = email,
                Password = password
            };

            var userInDb = await httpServices.Post <UserDto, LoginRequest>(uri, request);

            if (userInDb == null)
            {
                throw new Exception("Nem található a felhasználó");
            }

            return(userInDb);
        }