Exemplo n.º 1
0
        public async Task <ActionResult <WorkpacketSearchResponse> > SearchAll(string workpacketId)
        {
            WorkpacketSearchResponse result = null;

            var p360loginResponse = await _p360AuthenticationService.LoginAsync(_p360LoginData.CurrentValue);

            try
            {
                result = await _workpacketSearchService.SearchForClient(p360loginResponse.SessionTokenHeader, workpacketId);
            }
            finally
            {
                var p360logoutResponse = await _p360AuthenticationService.LogoutAsync(p360loginResponse.SessionTokenHeader, _p360LoginData.CurrentValue);
            }

            return(result);
        }
        public async Task <ActionResult <Workpacket> > UpdateFromWorkpacket(string workpacketId, [FromBody] UpdateRequest request)
        {
            var p360loginResponse = await _p360AuthenticationService.LoginAsync(_p360LoginData.CurrentValue);

            Workpacket updatedWorkpacket;

            try
            {
                var workpacket = await _workpacketSearchService.SearchAllAsync(p360loginResponse.SessionTokenHeader, (request.FormName, workpacketId));

                updatedWorkpacket = await _workpacketCreationService.CreateFromWorkpacketAsync(p360loginResponse.SessionTokenHeader, workpacketId, workpacket, request);
            }
            finally
            {
                var p360logoutResponse = await _p360AuthenticationService.LogoutAsync(p360loginResponse.SessionTokenHeader, _p360LoginData.CurrentValue);
            }

            return(updatedWorkpacket);
        }
Exemplo n.º 3
0
        public async Task <ActionResult <string> > GetWorkpacketId(string webId)
        {
            var p360loginResponse = await _p360AuthenticationService.LoginAsync(_p360LoginData.CurrentValue);

            Workpacket workpacket;

            try
            {
                workpacket = await _workpacketSearchService.SearchAllAsync(p360loginResponse.SessionTokenHeader, (null, webId));
            }
            finally
            {
                var p360logoutResponse = await _p360AuthenticationService.LogoutAsync(p360loginResponse.SessionTokenHeader, _p360LoginData.CurrentValue);
            }
            return(workpacket?.Id);
        }
        public async Task <ActionResult <Workpacket> > CreateAsync([FromBody] BaseForm workpacketCreateRequest)
        {
            Workpacket result = null;

            var p360loginResponse = await _p360AuthenticationService.LoginAsync(_p360LoginData.CurrentValue);

            try
            {
                result = await _workpacketCreationService.CreateAsync(p360loginResponse.SessionTokenHeader, workpacketCreateRequest);
            }
            finally
            {
                var p360logoutResponse = await _p360AuthenticationService.LogoutAsync(p360loginResponse.SessionTokenHeader, _p360LoginData.CurrentValue);
            }

            return(result);
        }
        public async Task <bool> DeleteWorkPacket(string workpacketId)
        {
            var p360loginResponse = await _p360AuthenticationService.LoginAsync(_p360LoginData.CurrentValue);

            bool response = false;

            try
            {
                var workpacketResult = await _workpacketSearchService.SearchAsync(p360loginResponse.SessionTokenHeader, workpacketId);

                response = await _workpacketDeletionService.DeleteWorkPacketAsync(p360loginResponse.SessionTokenHeader, workpacketResult.Id);
            }
            finally
            {
                var p360logoutResponse = await _p360AuthenticationService.LogoutAsync(p360loginResponse.SessionTokenHeader, _p360LoginData.CurrentValue);
            }

            return(response);
        }