コード例 #1
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DeleteGroupResponse response = new DeleteGroupResponse();


            return(response);
        }
コード例 #2
0
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            DeleteGroupResponse response = new DeleteGroupResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.IsStartElement)
                {
                    if (context.TestExpression("DeleteGroupResult", 2))
                    {
                        UnmarshallResult(context, response);
                        continue;
                    }

                    if (context.TestExpression("ResponseMetadata", 2))
                    {
                        response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context);
                    }
                }
            }

            return(response);
        }
コード例 #3
0
        public static DeleteGroupResponse Unmarshall(UnmarshallerContext context)
        {
            DeleteGroupResponse deleteGroupResponse = new DeleteGroupResponse();

            deleteGroupResponse.HttpResponse = context.HttpResponse;
            deleteGroupResponse.RequestId    = context.StringValue("DeleteGroup.RequestId");

            return(deleteGroupResponse);
        }
コード例 #4
0
        public static DeleteGroupResponse Unmarshall(UnmarshallerContext context)
        {
            DeleteGroupResponse deleteGroupResponse = new DeleteGroupResponse();

            deleteGroupResponse.HttpResponse = context.HttpResponse;
            deleteGroupResponse.RequestId    = context.StringValue("DeleteGroup.RequestId");
            deleteGroupResponse.Code         = context.IntegerValue("DeleteGroup.Code");
            deleteGroupResponse.Message      = context.StringValue("DeleteGroup.Message");
            deleteGroupResponse.Success      = context.BooleanValue("DeleteGroup.Success");

            return(deleteGroupResponse);
        }
コード例 #5
0
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            DeleteGroupResponse response = new DeleteGroupResponse();

            while (context.Read())
            {
                if (context.IsStartElement)
                {
                    if (context.TestExpression("ResponseMetadata", 2))
                    {
                        response.ResponseMetadata = ResponseMetadataUnmarshaller.GetInstance().Unmarshall(context);
                    }
                }
            }


            return(response);
        }
コード例 #6
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DeleteGroupResponse response = new DeleteGroupResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("Group", targetDepth))
                {
                    var unmarshaller = GroupUnmarshaller.Instance;
                    response.Group = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
コード例 #7
0
ファイル: GroupService.cs プロジェクト: yhsantosa/Pear
 public DeleteGroupResponse Delete(int id)
 {
     var response = new DeleteGroupResponse();
     try
     {
         var group = new Group { Id = id };
         DataContext.Groups.Attach(group);
         DataContext.Entry(group).State = EntityState.Deleted;
         DataContext.SaveChanges();
         response.IsSuccess = true;
         response.Message = "Group item has been updated successfully";
     }
     catch (DbUpdateException dbUpdateException)
     {
         response.IsSuccess = false;
         response.Message = dbUpdateException.Message;
     }
     return response;
 }
コード例 #8
0
        private static void UnmarshallResult(XmlUnmarshallerContext context, DeleteGroupResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.ReadAtDepth(originalDepth))
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                }
            }

            return;
        }
コード例 #9
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DeleteGroupResponse response = new DeleteGroupResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("RequestId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.RequestId = unmarshaller.Unmarshall(context);
                    continue;
                }
            }
            response.Status = (int)context.ResponseData.StatusCode;

            return(response);
        }
コード例 #10
0
ファイル: GroupService.cs プロジェクト: bagusdkusuma/PearWeb
        public DeleteGroupResponse Delete(int id)
        {
            var response = new DeleteGroupResponse();

            try
            {
                var group = new Group {
                    Id = id
                };
                DataContext.Groups.Attach(group);
                DataContext.Entry(group).State = EntityState.Deleted;
                DataContext.SaveChanges();
                response.IsSuccess = true;
                response.Message   = "Group item has been Deleted successfully";
            }
            catch (DbUpdateException dbUpdateException)
            {
                response.IsSuccess = false;
                response.Message   = dbUpdateException.Message;
            }
            return(response);
        }
コード例 #11
0
        public Task <bool> DeleteGroupByIdAsync(long groupId, CancellationTokenSource cancellationTokenSource) =>
        Task.Run(async() => {
            if (!CrossConnectivity.Current.IsConnected)
            {
                throw new InvalidOperationException(AppConsts.ERROR_INTERNET_CONNECTION);
            }

            bool deleteCompletion = false;

            DeleteGroupRequest deleteGroupRequest = new DeleteGroupRequest()
            {
                AccessToken = GlobalSettings.Instance.UserProfile.AccesToken,
                Url         = string.Format(GlobalSettings.Instance.Endpoints.GroupsEndpoints.DeletePostById, groupId)
            };

            try {
                DeleteGroupResponse deleteGroupResponse = await _requestProvider.PostAsync <DeleteGroupRequest, DeleteGroupResponse>(deleteGroupRequest);

                if (deleteGroupResponse != null)
                {
                    deleteCompletion = true;
                }
            }
            catch (ServiceAuthenticationException exc) {
                _identityUtilService.RefreshToken();

                throw exc;
            }
            catch (Exception exc) {
                Crashes.TrackError(exc);

                throw;
            }

            return(deleteCompletion);
        }, cancellationTokenSource.Token);