public int Insert(Customer_TypeEntity customer_type) { int res = 0; bool flag = false; try { var p = Param(customer_type); flag = (bool)unitOfWork.ProcedureExecute("ptgroup_Customer_Type_Insert", p); if (flag) { res = p.Get <int>("@Id"); } else { res = 0; } } catch (Exception ex) { Logging.PutError(ex.Message, ex); throw; } return(res); }
///Update public bool Update(Customer_TypeEntity customer_type) { bool res = false; try { var p = Param(customer_type, "edit"); res = (bool)unitOfWork.ProcedureExecute("ptgroup_Customer_Type_Update", p); return(res); } catch (Exception ex) { Logging.PutError(ex.Message, ex); throw; } }
/// <summary> /// Saves a record to the Employee table. /// </summary> private DynamicParameters Param(Customer_TypeEntity customer_type, string action = "add") { var p = new DynamicParameters(); if (action == "add") { p.Add("@Id", dbType: DbType.Int32, direction: ParameterDirection.Output); } else { p.Add("@Id", customer_type.Id); } p.Add("@ParentId", customer_type.ParentId); p.Add("@Name", customer_type.Name); p.Add("@IsDel", customer_type.IsDel); p.Add("@IsActive", customer_type.IsActive); return(p); }