简体   繁体   English

Web API 2之上的CRUD MVC Web应用程序

[英]CRUD MVC web application on top of Web API 2

I developed a Web API 2 web service, that is providing a lot of endpoints, where currently several pages and modules are asking for information. 我开发了一个Web API 2 Web服务,该服务提供了许多端点,当前有多个页面和模块正在请求信息。

This approach is good sinceI'm providing a lot of data in a good way to a lot of different clients. 这种方法很好,因为我以很好的方式向许多不同的客户提供了许多数据。

Now, I'd like to create a simple CRUD page by myself to show this information. 现在,我想自己创建一个简单的CRUD页面以显示此信息。

I'd like to start using ASP.NET 5, and I'm start looking for tutorial and resources, but I found info only about EF interaction, that is not my case. 我想开始使用ASP.NET 5,并且开始寻找教程和资源,但是我发现的信息仅是关于EF交互的,不是我的情况。

Can you help to collect resources to study and reach my goal? 您可以帮助收集资源来学习并实现我的目标吗?

Thanks, Roberto 谢谢罗伯托

I have written an application of exactly this architecture; 我已经写了一个完全符合这种架构的应用程序。 an ASP.NET 5.0 MVC application using a ASP.NET 4.5 Web API 2 for CRUD operations. 一个使用ASP.NET 4.5 Web API 2进行CRUD操作的ASP.NET 5.0 MVC应用程序。

As other folks have said, the API call itself can be achieved via HttpClient. 正如其他人所说的那样,API调用本身可以通过HttpClient来实现。

The way I've created the MVC pages in this scenario before is to use scaffolding against your model (Right click project > Add > New Scaffolded Item > MVC controller etc), but substitute the Entity Framework code in the controller with your own API calls. 在这种情况下,我之前创建MVC页面的方式是对模型使用脚手架(右键单击项目>添加>新建脚手架项目> MVC控制器等),但是用您自己的API调用替换控制器中的实体框架代码。 This way you get the scaffolded views and controller structure. 通过这种方式,您可以获得支架视图和控制器结构。

From your comment if you want to show a responsive web app to manipulate these entities then create a SPA and call the Web API directly. 如果您想显示一个响应式Web应用程序来操纵这些实体,请从您的评论中创建一个SPA并直接调用Web API。 To do this you could use any of the following frameworks: 为此,您可以使用以下任何框架:

http://www.angular.js http://www.angular.js

https://facebook.github.io/react/ https://facebook.github.io/react/

http://www.telerik.com/kendo-ui http://www.telerik.com/kendo-ui

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM