[Route("api/advertisement/{brandID}/{advertisementID}")]
public class BaseApiController : ApiController
{
public string AdvertisementID { get; private set; }
public int BrandID { get; private set; }
public BaseReportRepository ReportRepository { get; private set; }
protected override void Initialize(HttpControllerContext controllerContext)
{
base.Initialize(controllerContext);
var routeData = controllerContext.RouteData;
this.AdvertisementID = routeData.Values["advertisementID"].ToString();
this.BrandID = (int)routeData.Values["brandID"];
this.ReportRepository = RepositoryFactory
.CreateRepository(this.BrandID)
.ReportRepository;
}
}
why can not get the router data brandID
ApiController'sInitializemethod doesn't have an override includingbrandIDandadvertismentID.