/// <summary> /// 增添数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public string Add(BanJiModel model) {; BanJiData BanJi = new BanJiData(); var query = BanJi.DataList().Where(r => r.Bjbh == model.Bjbh); if (query.Count() > 0) { return JsonConvert.SerializeObject(new ResultEx(false, "班级编号已经存在")); } else { try { BanJi.Add(model); return JsonConvert.SerializeObject(new ResultEx(true)); } catch (Exception ex) { return JsonConvert.SerializeObject(new ResultEx(false,ex.Message)); } } }
/// <summary> /// 获取数据表数据列表 /// </summary> string IBanJiServices.TableQuery() { BanJiData BanJi = new BanJiData(); List<BanJiModel> list = BanJi.DataList(); return JsonConvert.SerializeObject(list); }