public virtual IActionResult Post([FromBody] T model) { try { var activeEntity = model as ICommonData; if (activeEntity != null) { activeEntity.Active = true; model = activeEntity as T; } var result = _baseRepo.Add(model); return(Ok(result)); } catch (Exception ex) { return(Ok(new { status = -1, message = ex.Message })); } }
public int Add(RoadFlow.Data.Model.BuildingMonthInfoModel model) { if (baseDb.Add <RoadFlow.Data.Model.BuildingMonthInfoModel>(model) > 0) { Dictionary <KeyValuePair <string, RoadFlow.Data.Model.SQLFilterType>, object> where = new Dictionary <KeyValuePair <string, Data.Model.SQLFilterType>, object>(); where.Add(new KeyValuePair <string, RoadFlow.Data.Model.SQLFilterType>("TimeArea", RoadFlow.Data.Model.SQLFilterType.MINNotEqual), model.TimeArea); if (GetAll(where).Rows.Count == 0)//是否是最新的每月数据。 //更新合成表 { BuildingsAndBuildingMonthInfoBLL buildingsAndBuildingMonthInfoBLL = new BuildingsAndBuildingMonthInfoBLL(); Guid id = model.BuildingID.Value; //排除不需要更新的字段。 model.ID = null; model.BuildingID = null; model.BuildingMonthInfoID = null; model.TimeArea = null; return(buildingsAndBuildingMonthInfoBLL.Update(model, id)); } #region 注释掉的代码 //RoadFlow.Data.Model.BuildingsAndBuildingMonthInfo monthModel = new RoadFlow.Data.Model.BuildingsAndBuildingMonthInfo(); //monthModel.SY_YSY_ZMJ = model.SY_YSY_ZMJ; //monthModel.SY_YSY_ZYMJ = model.SY_YSY_ZYMJ; //monthModel.SY_KZ_ZMJ = model.SY_KZ_ZMJ; //monthModel.SY_KZ_KZLMJ = model.SY_KZ_KZLMJ; //monthModel.SY_KZ_KXSMJ = model.SY_KZ_KXSMJ; //monthModel.SY_ZJ = model.SY_ZJ; //monthModel.SY_XSJJ = model.SY_XSJJ; //monthModel.SW_YSY_ZMJ = model.SW_YSY_ZMJ; //monthModel.SW_YSY_ZYMJ = model.SW_YSY_ZYMJ; //monthModel.SW_KZ_ZMJ = model.SW_KZ_ZMJ; //monthModel.SW_KZ_KZLMJ = model.SW_KZ_KZLMJ; //monthModel.SW_KZ_KXSMJ = model.SW_KZ_KXSMJ; //monthModel.SW_ZJ = model.SW_ZJ; //monthModel.SW_XSJJ = model.SW_XSJJ; #endregion } return(0); }
//public AppLibrary() //{ // this.dataAppLibrary = Data.Factory.Factory.GetAppLibrary(); //} /// <summary> /// 新增 /// </summary> public int Add(RoadFlow.Data.Model.AppLibraryModel model) { //return dataAppLibrary.Add(model); return(BaseDb.Add(model)); }
public int Add(RoadFlow.Data.Model.ArticleModel model) { return(baseDb.Add <RoadFlow.Data.Model.ArticleModel>(model)); }
public int Add <T>(T model) { return(BaseDb.Add <T>(model)); }
/// <summary> /// 新增 /// </summary> public int Add(RoadFlow.Data.Model.DictionaryModel model) { //return dataDictionary.Add(model); return(BaseDb.Add(model)); }
public bool Add(T t) { return(dal.Add(t) > 0); }