3

Trying to send request using Refit to controller:

[HttpGet("api/users/{userId}/appointments")]
public async Task Get(Guid userId, [FromQuery] FilterRow[] filters = null) {}

Added interface with this method:

[Get("/api/users/{userId}/appointments")]
Task<IEnumerable> Get([AliasAs("userId")] Guid userId, [AliasAs("filters")] FilterRow[] filters);

FilterRow:

public class FilterRow
{
    public string FieldName { get; set; }
    public string FilterValue { get; set; }
    public FilterCondition FilterCondition { get; set; }
}

public enum FilterCondition
{
    Equals = 0,
    LessThan = 1,
    LessThanOrEqual = 2,
    GreaterThan = 3,
    GreaterThanOrEqual = 4,
    NotEquals = 5
}

Tried to add RefitUrlParameterFormatter. But to it's function Format comes separate values from this object. Solved this using IFormattable to this object, but even with this it didn't work correctly (Controller didn't get any values)

0 Answers0