0

I am having a trouble to generate webApi Url in mvc view.

// Web API routes
config.MapHttpAttributeRoutes();

ApiController

[RoutePrefix("api/v1/bikes")]
public class bikesController : ApiController
{
    [Route("", Name = "PostBike")]
    public async Task<IHttpActionResult> PostBike([FromBody]Bike bike)
    {
       //do stuff
    }
}

area registration

public override string AreaName 
{
    get 
    {
        return "V1";
    }
}

So the question is how to get absolute url (PostBike) in OtherController : Controller(its in the same area 'V1') View

I have tried many variations, and they don't work. thanks for help.

Federico Dipuma
  • 17,655
  • 4
  • 39
  • 56
aurimas
  • 67
  • 10

0 Answers0