Post complex types to WebApi Client
- by BumbleBee
I am new to WebAPI.  
I have a MVC project and webApi project both reside under the **same solution**.  Also, BLL Class library and DAL class library reside under the same solution. 
Earlier, my MVC project will talk to the BLL  now I am trying to create a WebAPi project which stands in between MVC and BLL.  
Here is what I have come up with so far :
I'm using the HTTPClient to post to a WebApi project. My post method on my controller accepts a single parameter (a model).
  StatsCriteria criteria = new StatsCriteria();
......
    var client = new HttpClient();
    var response = client.PostAsJsonAsync("http://localhost:52765/api/reports", criteria).Result;
    .......
Here's the signature for my controller in Webapi 
[HttpPost]
public CMAReportVM Reports([FromBody] StatsCriteria criteria)
{
  var cmaReport = Service3.GetCMAReport(criteria.Mlsnums);
   //Create Map to enable mapping business object to View Model
             Mapper.CreateMap<CMAReport, CMAReportVM>();
   // Maps model to VM model class 
             var cmaVM = Mapper.Map<CMAReport, CMAReportVM>(cmaReport);
  reutn cmaVM; 
}
// and here's my routing:
config.Routes.MapHttpRoute(
  name: "DefaultApi",
  routeTemplate: "api/{controller}/{id}",
  defaults: new { id = RouteParameter.Optional }
I am getting the following
 405 : Method not allowed.
As the WebAPI and MVC project both reside under same sloution I am not sure where/how to host my webapi.