0
我想使用nopCommerce返回2個列表,這兩個列表都是隻讀的, 我正在尋找最簡單的方法來做這件事,因爲我正在編寫一個地鐵應用程序,而我並不真的想花數週時間學習MVC。 第一個列表是從所述基部nopCommerce平臺類別的列表,第二列表是產品的列表。 這兩個列表都需要作爲JSON返回給調用客戶端。返回類別列表nopCommerce
我有兩個問題:
- 有沒有辦法我能得到這個列表而不調用自定義代碼?
我用下面的代碼
using System.Collections; using System.Collections.Generic; using System.Web.Mvc; using Nop.Core; using Nop.Core.Domain.Catalog; using Nop.Services.Catalog; using Nop.Services.Customers; using Nop.Core.Plugins; namespace Nop.Plugin.Other.ONWWW.Controllers { public class ONWWWController : Controller { public ICategoryService _categoryService; public ONWWWController(ICategoryService categoryService) { this._categoryService = categoryService; } public ActionResult Index() { return Json(_categoryService.GetAllCategories(), JsonRequestBehavior.AllowGet); } } }
爲什麼,當我運行的代碼,我收到以下錯誤寫了一個插件?
此對象定義無參數的構造函數。