public void Remove(HelloWorldModel model)
 {
     //模拟底层出错的情况
     if (_demoList.Count < 2)
     {
         throw new JException("必须得留一个");
     }
     _demoList.Remove(model);
 }
 public JsonResult Add(HelloWorldModel model)
 {
     if (_service.GetData().Count >= 8)
     {
         return(JsonTips("error", "商品数量太多了!"));
     }
     model.SalerName = CurrentUser.Name;
     _service.Add(model);
     return(JsonTips("success", "商品添加成功", model.Name + "添加成功!"));
 }
 public void Add(HelloWorldModel model)
 {
     model.CreateTime = DateTime.Now;
     model.Id         = _demoList.Max(m => m.Id) + 1;
     _demoList.Add(model);
 }