【发布时间】:2012-10-09 11:35:43
【问题描述】:
我正在尝试使用 nopCommerce 返回 2 个列表,这两个列表都是只读的, 我正在寻找最简单的方法,因为我正在编写一个地铁应用程序,我真的不想花几周时间学习 MVC 。 第一个列表是来自基础 nopCommerce 平台的类别列表,第二个列表是产品列表。 两个列表都需要以 JSON 格式返回给调用客户端。
我有两个问题:
- 有没有一种方法可以在不调用自定义代码的情况下获取此列表?
-
我用下面的代码写了一个插件
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); } } }为什么,当我运行代码时,出现以下错误?
没有为此对象定义无参数构造函数。
【问题讨论】: