public JsonResult Edit(DishesSpec model)
        {
            try
            {
                if (model.DishesSpecId > 0)
                {
                    var entity = _DishesSpecService.GetById(model.DishesSpecId);
                    //修改
                    entity.Name = model.Name;

                    //执行更新
                    _DishesSpecService.Update(entity);
                }
                else
                {
                    //新增
                    _DishesSpecService.Insert(model);
                }
            }
            catch (Exception)
            {
                return(Json(new { Status = Successed.Error, Info = Successed.Error.ToString() }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { Status = Successed.Ok }, JsonRequestBehavior.AllowGet));
        }
Example #2
0
 /// <summary>
 /// 删除实体
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public void Delete(DishesSpec model)
 {
     this._DishesSpecBiz.Delete(model);
 }
Example #3
0
 /// <summary>
 /// 修改实体
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public void Update(DishesSpec model)
 {
     this._DishesSpecBiz.Update(model);
 }
Example #4
0
 /// <summary>
 /// 添加实体
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public DishesSpec Insert(DishesSpec model)
 {
     return(this._DishesSpecBiz.Insert(model));
 }
 /// <summary>
 /// 删除实体
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public void Delete(DishesSpec model)
 {
     this._repoDishesSpec.Delete(model);
 }
 /// <summary>
 /// 修改实体
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public void Update(DishesSpec model)
 {
     this._repoDishesSpec.Update(model);
 }
 public DishesSpec Insert(DishesSpec model)
 {
     return(this._repoDishesSpec.Insert(model));
 }