public IHttpActionResult SaveBizCategory(BizCategoryViewModel category) { try { _setting.SaveCategory(category); } catch (Exception err) { ResMessage.Fail(err.Message); } return(Ok(ResMessage.Success())); }
public BizCategory SaveCategory(BizCategoryViewModel cate) { BizCategory bizCate = new BizCategory(); if (cate.CateId > 0) { bizCate = this.GetBizCategory(cate.CateId); } bizCate.CategoryName = cate.CategoryName; bizCate.SortIndex = cate.SortIndex; _context.BizCategories.AddOrUpdate(bizCate); _context.SaveChanges(); return(bizCate); }