public ActionResult List(GoodsQuery query) { var list = this.GoodsRepository.GetList(query); var data = list.Data.Select(c => GoodsModel.From(c)).ToList(); var result = new { total = list.RecordCount, rows = data }; return(Json(result)); }
public ActionResult GetGoods(int id) { var goods = this.GoodsRepository.Get(id); if (goods != null) { return(JsonSuccess(GoodsModel.From(goods))); } return(JsonError("未找到商品")); }
public ActionResult Detail(int id) { Goods item = this.GoodsRepository.Get(id); if (item == null) { item = new Goods(); } ViewData["Category"] = this.GoodsTypeRepository.GetGoodsTypes(item.Id); return(View(GoodsModel.From(item))); }
public ActionResult GetByPinyin(string q) { if (q.IsNullOrEmpty()) { return(Json(new { total = 0, rows = new List <GoodsType>() })); } var list = this.GoodsRepository.GetAll(new GoodsQuery { Pinyin = q }); var data = list.Select(c => GoodsModel.From(c)).ToList(); var result = new { total = list.Count, rows = data }; return(Json(result)); }