1

When I'm passing data in both url and content:

  1. My MVC controllers are able to read data from it and gives me proper model.
  2. My WEB API controller doesn't provide proper object it misses a data which is passed as a content.

What is the difference between this two model binding scenarios?

jpgrassi
  • 5,482
  • 2
  • 36
  • 55
Nilesh Moradiya
  • 691
  • 1
  • 10
  • 19

1 Answers1

0

MVC: model view controller, so you pass pass your model from controller to view. Your view is rendered server side.

With web api you can develop single page applications.Web api is used as Rest api, you query through controller and controller returns DTOs can be converted to json objects at client. Web api does not allow pass your entities resulting circular dependencies. you render your view at client through ajax queries. Either as in example from this link you can pass parameters to controller

http://localhost/api/values/?Latitude=47.678558&Longitude=-122.130989

or you can query your data through queries as in example from this link

http://localhost/Products?$filter=Category eq 'Toys'
asdf_enel_hak
  • 7,474
  • 5
  • 42
  • 84