/// <summary> /// 增添数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public string Add(YuanXiModel model) { YuanXiData YuanXi = new YuanXiData(); var query = YuanXi.DataList().Where(r => r.Code == model.Code); if (query.Count() > 0) { return JsonConvert.SerializeObject(new ResultEx(false, "院系代码已经存在")); } else { try { YuanXi.Add(model); return JsonConvert.SerializeObject(new ResultEx(true)); } catch (Exception ex) { return JsonConvert.SerializeObject(new ResultEx(false, ex.Message)); } } }
protected override void Add(object model) { base.Add(model); YuanXi = new YuanXiModel(); }
/// <summary> /// 更新数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Update(YuanXiModel model) { YuanXiData YuanXi = new YuanXiData(); return YuanXi.Update(model); }
/// <summary> /// 删除数据 /// </summary> /// <param name="model"></param)> /// <returns></returns> public int Delete(List<int> ids, YuanXiModel model = null) { YuanXiData yuanxi = new YuanXiData(); return yuanxi.Delete(ids); }