Skip to content
This repository was archived by the owner on Nov 3, 2022. It is now read-only.
This repository was archived by the owner on Nov 3, 2022. It is now read-only.

Add translation to GET and POST routes with Int and String parameters #6

@mdmoura

Description

@mdmoura

Hello,

I am having a few problems to translate the following two routes:

[Route("documents"), HttpGet]
public virtual ActionResult Documents(Int32 page = 1)  { }

[Route("documents"), HttpPost]
public virtual ActionResult Documents(String query, Int32 page = 1)  { }

Basically the first route gets a paged list of documents, using page = 1 when not specified. And the second also accepts a string query to filter the documents.

So for translation I am using the following:

.ForAction(x => x.Documents(), new Type[] { typeof(Int32) }).AddTranslation("documentos")
.ForAction(x => x.Documents(), new Type[] { typeof(String), typeof(Int32) }).AddTranslation("documentos")

But I get the errors:
An expression tree may not contain a call or invocation that uses optional arguments
An expression tree may not contain a call or invocation that uses optional arguments

I tried a few variations of this but I always get an error.

Any idea what might be wrong?

Thank You,
Miguel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions