public ActionResult Create(CreateShoping shoping) { if (string.IsNullOrEmpty(shoping.commodityName)) { return(Json("商品名称不能未空!")); } return(Json(shoping.Create())); }
public ActionResult ShopingManager() { int id = 0; CreateShoping home = _unityContainer.Resolve <CreateShoping>(); id = commodityService.GetMaxId() + 1; var list = specificationService.QueryAll().ToList(); var selectList = list.Select(x => new SelectListItem { Text = x.Name, Value = x.specificationId.ToString() }); ViewData["specification"] = selectList; var CommodityCategorys = ICommodityCategorysService.GetAll(); var CommodityCategorysList = CommodityCategorys.Select(x => new SelectListItem { Text = x.name, Value = x.commodityCategoryId.ToString() }).ToList(); ViewData["CommodityCategorysList"] = CommodityCategorysList; var model = new EcardModelItem <CreateShoping>(home); model.Item.commodityNo = "00000" + id; return(View(model)); }