/// <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> /// <param name="model"></param> /// <returns></returns> public int Update(BanJiModel model) { BanJiData BanJi = new BanJiData(); return BanJi.Update(model); }
/// <summary> /// 删除数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Delete(BanJiModel model) { BanJiData BanJi = new BanJiData(); return BanJi.Delete(model.Id); }
/// <summary> /// 删除数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Delete(List<int> ids, BanJiModel model = null) { BanJiData BanJi = new BanJiData(); return BanJi.Delete(ids); }
protected override void Add(object model) { base.Add(model); BanJi = new BanJiModel(); }