1

我想使用 OfferFilter 类来处理报价请求:

public class OfferFilter
{
    public int SortOrder { get; set; }
    public int PageSize { get; set; }
    public int PageNumber { get; set; }
    public string SearchQuery { get; set; }
    public bool ShowAllLanguages { get; set; }
    public int? SearcherSectorId { get; set; }
    public int? CountryId { get; set; }
    public int? RegionId { get; set; }
    public string City { get; set; }
    public int? AskingPriceFrom { get; set; }
    public int? AskingPriceTo { get; set; }
    public bool AskingPriceSelected { get; set; }
    public int? SalesRevenuesFrom { get; set; }
    public int? SalesRevenuesTo { get; set; }
    public bool SalesRevenuesSelected { get; set; }
    public int? IncomeFrom { get; set; }
    public int? IncomeTo { get; set; }
    public bool IncomeSelected { get; set; }
    public int? Age { get; set; }
}

我怎样才能为此制作路线属性?使用 POST 会更容易,但它将是 GET 请求。正常的路由字符串会很大并且很容易出错。

4

1 回答 1

1

请参阅有关路由的 wiki 页面。您只需要注册服务的路径信息,您仍然可以使用 QueryString 中的任何属性,例如:

[Route("/offers/search")]
public class OfferFilter { ... }

允许您以任意组合调用上述服务,例如:

/offers/search?city=XXX
/offers/search?city=XXX&Age=20
etc.
于 2013-05-29T15:04:56.450 回答