They are separate things, so it is not a matter of being advantageous to use one or the other. They should be used for different purposes. Although they could be used together.
So much so that the ASP.NET Webapi has become an integral part of the ASP.NET Core. You no longer use one or the other because essentially they have different operations when you want to do one or the other (essentially the Webapi does not have view), but the basis is the same.
The MVC assumes that the user will access websites which are collections of pages to view. Webapi only returns results, it obviously have no views, the V of MVC.
Webapi has always needed a simpler structure, but if you think about it they need models (M) and they need, if not the controllers (C), something very similar. That’s why it makes more sense to use one framework single.
Working with Webapi is easier for a simple reason, it does much less. And precisely why if you want to present pages, Webapi is not an option. At least not alone.
Of course it is possible to use Webapi to pick up the results and assemble the pages with another technology. But I doubt it makes any sense to you. It can do to third party consumers of your API. By third party, understand other programmers or other applications made by you.
As the name says Webapi is for creating access Apis in the templates of web. API is for programmers to consume and as it suits them best. It is not to build websites whole.
You can even make the form entirely on the client side (type SPA). Then I wouldn’t need the MVC, but this doesn’t work well for websites, works best for applications.
So Webapi doesn’t assemble a form for you because it’s not your goal.
I think in this case you should use MVC.
Or if you’re going to do something simpler consider ASP.NET Webpages (ASP.NET Razor Pages even better). It’s curious how almost no one knows this. I see many programmers killing themselves to use ASP.NET MVC to do it websites very simple, simply because they do not know everything that exists in ASP.NET. This technology allows to do websites analogous to what is done in pure PHP using only what is already available by default in the language. Webpages/Razor Pages gives a whole infrastructure that helps a lot without imposing a development model.
Also consider using Blazor on the server side. Avoid using the classic ASP.NET MVC used in .NET Framework that died.
The next time I see a cute MVC defender with DDD or something I’m going to pass the Webpages link, then he mounts the entire site in hand. Great recommendation. + 1.
– Leonel Sanches da Silva
What is the Webpages? How can I create a project of the kind ASP.Net Webpages?
– gato
@Denercarvalho is what’s in link. A fairly extensive question to put in a comment. It is a simpler way to make websites that do not require great complexity. Basically you produce the individual pages without much ceremony or development model. It’s very free. It has the vew which is almost equal to ASP.Net MVC. It has some facilities to manipulate what comes from the customer, to assemble what he needs, but nothing as ready as in MVC. But it is more flexible and simple to use. It does not impose a model, but you can have if you want. The link of everything you do as you want.
– Maniero
@Denercarvalho can start here: https://www.asp.net/web-pages/overview/getting-started/introducing-aspnet-web-pages-2/getting-started
– Maniero