/// <summary> /// IP登记表删除服务,传入对象进行删除操作 /// </summary>20170117XCQ /// <param name="model"></param> /// <returns></returns> public CommonResult <IPRegistForm> DeleteRegistFormById(IPRegistForm model) { var result = new CommonResult <IPRegistForm>(); try { var dbSession = new DBService <IPRegistForm>().DbSession; using (System.Transactions.TransactionScope ts = new System.Transactions.TransactionScope()) { var ServerModel = dbSession.GetQueryable(t => t.ID == model.ID).FirstOrDefault(); if (ServerModel != null) { dbSession.Delete(ServerModel); ts.Complete(); result.IsSuccess = true; } else { result.IsSuccess = false; } } } catch (Exception ex) { Utils.Logger.Error(ex.Message); throw ex; } return(result); }
public CommonResult <IPRegistForm> DeleteRegistFormById(string sessionId, IPRegistForm model) { try { return(ForCfPExecuteServices.GetInstance(sessionId).DeleteRegistFormById(model)); } catch (Exception ex) { throw new FaultException <CustomFaultMessage>(new CustomFaultMessage() { ErrorCode = ex.HResult, Message = ex.Message, StackTrace = ex.StackTrace }, ex.Message); } }
/// <summary> /// IP登记表的更新服务,传入对象为该数据表的model /// </summary>20170117XCQ /// <param name="model"></param> /// <returns></returns> public CommonResult <IPRegistForm> UpdateRegistForm(IPRegistForm model) { var result = new CommonResult <IPRegistForm>(); try { var dbSession = new DBService <IPRegistForm>().DbSession; using (System.Transactions.TransactionScope ts = new System.Transactions.TransactionScope()) { result.Data = dbSession.Update(model); ts.Complete(); } } catch (Exception ex) { Utils.Logger.Error(ex.Message); throw ex; } return(result); }