public void SaveRoleMenus(Int64 roleId, Int64[] menuIds) { db.Execute("DELETE FROM security.role_menus WHERE role_id = @role_id", new { role_id = roleId }); if (menuIds.Length > 0) { db.Execute(string.Format( "INSERT INTO security.role_menus(role_id, menu_id) SELECT @role_id, menu_id FROM unnest(array[{0}]) AS menu_id", string.Join <Int64>(",", menuIds)), new { role_id = roleId }); } }
public void LogError(DateTime date, string message, string stackTrace) { db.Execute(@"insert into hr.errors(exception_date, exception_message, exception_stack_trace) values(@exception_date, @exception_message, @exception_stack_trace)", new { exception_date = date, exception_message = message, exception_stack_trace = stackTrace }); }
public void InsertRole(Role role) { db.Execute("insert into security.roles(role_name, permission_levels) values(@role_name, @permission_levels)", new { role_name = role.RoleName, permission_levels = string.Join(",", role.PermissionLevels) }); }