Ejemplo n.º 1
0
        public static PostCategoryTreeRequest ToPostRequest(this GetCategoryTreeResponse response)
        {
            var model = MapPageModel(response, true);

            return(new PostCategoryTreeRequest {
                Data = model
            });
        }
Ejemplo n.º 2
0
        public static PutCategoryTreeRequest ToPutRequest(this GetCategoryTreeResponse response)
        {
            var model = MapPageModel(response, false);

            return(new PutCategoryTreeRequest {
                Data = model, Id = response.Data.Id
            });
        }
Ejemplo n.º 3
0
        public static GetCategoryTreeResponse Unmarshall(UnmarshallerContext context)
        {
            GetCategoryTreeResponse getCategoryTreeResponse = new GetCategoryTreeResponse();

            getCategoryTreeResponse.HttpResponse = context.HttpResponse;
            getCategoryTreeResponse.RequestId    = context.StringValue("GetCategoryTree.RequestId");
            getCategoryTreeResponse.CategoryTree = context.StringValue("GetCategoryTree.CategoryTree");

            return(getCategoryTreeResponse);
        }
        public async Task <GetCategoryTreeResponse> GetCategoryTree(GetCategoryTreeRequest request)
        {
            string url = "commerce/taxonomy/v1_beta/category_tree/{0}";

            RestHelper helper   = new RestHelper(string.Format(url, request.category_tree_id));
            var        response = await helper.Get();

            GetCategoryTreeResponse serlializedResponse = JsonConvert.DeserializeObject <GetCategoryTreeResponse>(response);

            return(serlializedResponse);
        }
Ejemplo n.º 5
0
        private static SaveCategoryTreeModel MapPageModel(GetCategoryTreeResponse response, bool resetIds)
        {
            var model = new SaveCategoryTreeModel
            {
                Version = response.Data.Version,
                Name    = response.Data.Name,
//                AccessRules = response.AccessRules,
            };

            if (response.Nodes != null)
            {
                model.Nodes = GetSubNodes(response.Nodes.Where(n => n.ParentId == null).Select(n => ToModel(n, resetIds)).ToList(), response.Nodes, resetIds);
            }

            return(model);
        }
Ejemplo n.º 6
0
        private static SaveCategoryTreeModel MapPageModel(GetCategoryTreeResponse response, bool resetIds)
        {
            var model = new SaveCategoryTreeModel
            {
                Version = response.Data.Version,
                Name = response.Data.Name,
//                AccessRules = response.AccessRules,
            };

            if (response.Nodes != null)
            {
                model.Nodes = GetSubNodes(response.Nodes.Where(n => n.ParentId == null).Select(n => ToModel(n, resetIds)).ToList(), response.Nodes, resetIds);
            }

            return model;
        }