/// <summary> /// Saves a record to the Role_Group table. /// </summary> public int Insert(Role_GroupEntity role_Group) { int res = 0; bool flag = false; try { var p = Param(role_Group); flag = (bool)unitOfWork.ProcedureExecute("ptgroup_Role_Group_Insert", p); if (flag) { res = p.Get <int>("@ID"); } else { res = 0; } } catch (Exception ex) { Logging.PutError(ex.Message, ex); throw; } return(res); }
/// <summary> /// Saves a record to the Role_Group table. /// </summary> private DynamicParameters Param(Role_GroupEntity role_Group, string action = "add") { var p = new DynamicParameters(); if (action == "edit") { p.Add("@ID", role_Group.ID); } else { p.Add("@ID", dbType: DbType.Int32, direction: ParameterDirection.Output); } p.Add("@Name", role_Group.Name); return(p); }
/// <summary> /// Updates a record in the Role_Group table. /// </summary> public bool Update(Role_GroupEntity role_Group) { bool res = false; try { var p = Param(role_Group, "edit"); res = (bool)unitOfWork.ProcedureExecute("ptgroup_Role_Group_Update", p); return(res); } catch (Exception ex) { Logging.PutError(ex.Message, ex); throw; } }