Trying to add a new endpoint to the radzen blazor studio generated Controller

I made a partial.
I verified that the partial is working (i can type this. and see all the other functions in the other file).

i have tried multiple ways but right now it looks like this
[Route("odata/aci/LstEmployes")]
public partial class LstEmployesController : ODataController
{

    [HttpGet("DeleteUnusedLstEmploye({key})")]
    public IActionResult DestroyUnusedLstEmploye(int key)
    {
        try
        {
            if(!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var item = this.context.LstEmployes.Where(i => i.noEmployeAuto == key).FirstOrDefault();

            if (item == null)
            {
                return BadRequest();
            }

            /// 
            this.context.LstEmployes.Update(item);
            this.context.SaveChanges();
        
            return Ok();
        }
        catch(Exception ex)
        {
            ModelState.AddModelError("", ex.Message);
            return BadRequest(ModelState);
        }
    }

and in my service
public async Task DeleteUnusedLstEmploye(int id)
{
var uri = new Uri(baseUri, $"LstEmployes/DeleteUnusedLstEmploye({id})");

        var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, uri);

        var response = await httpClient.SendAsync(httpRequestMessage);
        Console.WriteLine(response.ToString());

    }

but no matter what i try I cant get to call this endpoint

I suspect there are conventions im not aware of with odata

Hi @Patrick_Gueriguian,

Indeed ODataControllers require extra configuration (as far as I know). Here is an excerpt from an in-house application:

Method (defined in LicensesControllers.Partial.cs)

[HttpGet]
[EnableQuery(MaxExpansionDepth=10,MaxAnyAllExpressionDepth=10,MaxNodeCount=1000)]
[Route("/odata/RadzenDb/GetOrdersForMonth(Month={month})")]
public async Task<IActionResult> GetOrdersForMonth(DateTime month)
{
    var orders = await dbService.GetOrdersForMonth(month);

    return Ok(sales);
}

Registration (in Program.cs)

var oDataBuilderRadzenDb = new ODataConventionModelBuilder();
oDataBuilderRadzenDb.Function(nameof(LicensesController.GetOrdersForMonth)).ReturnsCollectionFromEntitySet<Admin.Server.Models.RadzenDb.Order>("Orders").Parameter<DateTime>("Month");

Invocation (RadzenDbService.Partial.cs)

public async Task<Radzen.ODataServiceResult<Order>> GetOrdersForMonth(DateTime month, string filter = default, string orderby = default, string expand = default, int? top = default, int? skip = default, bool? count = default, string select = default)
{
   var uri = new Uri(baseUri, $"GetOrdersForMonth(Month={month:yyyy-MM-ddTHH:mm:ssZ})");

   uri = Radzen.ODataExtensions.GetODataUri(uri: uri, filter:filter, top:top, skip:skip, orderby:orderby, expand:expand, select:select, count:count);

   var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, uri);

   var response = await httpClient.SendAsync(httpRequestMessage);

   return await Radzen.HttpResponseMessageExtensions.ReadAsync<Radzen.ODataServiceResult<Order>>(response);
}