コード例 #1
0
        public ActionResult ReadCategory(CategoryEbayModel data, int pageIndex = 1, int pageSize = int.MaxValue)
        {
            var model = _affiliateEbayService.GetAllCategories(pageIndex - 1, pageSize);

            var gridModel = new DataSourceResult
            {
                Data  = model,
                Total = model.TotalCount,
            };

            //result.MaxJsonLength = Int32.MaxValue;
            return(Json(gridModel));
        }
コード例 #2
0
        public ActionResult MappingCategory()
        {
            bool   status  = false;
            string message = "";

            if (Request.Form.Count > 0)
            {
                var models = JsonConvert.DeserializeObject <List <CategoryEbayModel> >(Request.Form[0]);

                if (models != null)
                {
                    var model        = models[0];
                    var category     = _categoryService.GetCategoryById(model.CategoryID);
                    var categoryEbay = _affiliateEbayService.Get(model.Id);
                    if (categoryEbay != null && category != null)
                    {
                        var categoryMap = _affiliateEbayService.MapCategory(categoryEbay.Id, category.Id);
                        if (categoryMap.Id > 0)
                        {
                            var result = new CategoryEbayModel
                            {
                                EbayId           = categoryEbay.EbayId,
                                CategoryID       = category.Id,
                                CategoryMapID    = categoryMap.Id,
                                CategoryName     = category.Name,
                                Name             = categoryEbay.Name,
                                Id               = categoryEbay.Id,
                                ParentCategoryId = categoryEbay.ParentCategoryId
                            };
                            return(Json(result));
                        }
                    }
                }
            }
            return(Json(new { Status = status, Message = message }));
        }