public void SubmitForm(ModuleFormInstanceEntity entity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { entity.Modify(keyValue); service.Update(entity); } else { entity.Create(); service.Insert(entity); } }
/// <summary> /// 保存一个实体 /// </summary> /// <param name="keyValue"></param> /// <param name="entity"></param> /// <returns></returns> public int SaveEntity(string keyValue, ModuleFormInstanceEntity entity) { if (string.IsNullOrEmpty(keyValue)) { entity.Create(); return(this.BaseRepository().Insert(entity)); } else { entity.Modify(keyValue); return(this.BaseRepository().Update(entity)); } }