Just saying I'd rather not make changes to my client app since it still need to use my old api, written in asp.net web api.
I believe I'm doing exactly the same thing in both my old api and the .core api, but with the latter, the model's properties posted are all null/empty/0
I did add json formatters to the .core api's mvc.start()
"Old Api"
[HttpPost, Route("products/search")] public IHttpActionResult Search(ProductSearchViewModel search) { var result = new ProductSearchResult(); // get the data return Ok(result); }
New Api
[HttpPost, Route("search")] public ProductSearchResultsViewModel Search( Product SearchViewModel search) { var data = _repository.Search(search.Search); var result = new ProductSearchResultsViewModel { Deals = data.Select(item => new ProductSearchResultViewModel { Id = item.Id, // etc }).ToList() }; return result; }
I experimented with [FromBody] but then the api return a media type not supported error