// insert the permission public async Task insertPerm(InsertPermission result) { using var cmd = Db.Connection.CreateCommand(); cmd.CommandText = @"insert into db_final.permission (permission_name) values(@permissionName);"; BindId2(cmd, result.PermissionName); cmd.CommandText = cmd.CommandText; await cmd.ExecuteNonQueryAsync(); }
public async Task <IActionResult> insertnewPermission([FromBody] InsertPermission body) { await Db.Connection.OpenAsync(); var query = new BlogPostQuery(Db); var result = new InsertPermission(); //result.id = body.id; result.PermissionName = body.PermissionName; await query.insertPerm(result); return(new OkObjectResult(result)); }