/// <summary> /// Updates a record in the LocaltionStatus table. /// </summary> public bool Update(LocaltionStatusEntity obj) { try { var p = Param(obj, "edit"); var res = unitOfWork.ProcedureExecute("Sp_LocaltionStatus_Update", p); return(res); } catch (Exception ex) { Logging.PutError(ex.Message, ex); throw; } }
/// <summary> /// Saves a record to the LocaltionStatus table. /// </summary> public long Insert(LocaltionStatusEntity obj) { long res; try { var p = Param(obj); var flag = unitOfWork.ProcedureExecute("Sp_LocaltionStatus_Insert", p); res = flag ? p.Get <long>("@Id") : 0; } catch (Exception ex) { Logging.PutError(ex.Message, ex); throw; } return(res); }
/// <summary> /// Saves a record to the LocaltionStatus table. /// </summary> private DynamicParameters Param(LocaltionStatusEntity obj, string action = "add") { var p = new DynamicParameters(); p.Add("@Name", obj.Name); if (action == "add") { p.Add("@Id", dbType: DbType.Int64, direction: ParameterDirection.Output); } else if (action == "edit") { p.Add("@Id", obj.Id); } return(p); }