002. AngularJs calls Restful to implement CRUD

Source: Internet
Author: User

This section describes how AngularJs calls Restful to implement CRUD of data.

The main technologies used:

Backend: ASP. NET WebApi + SQLServer2008

Front-end: AngularJs, Bootstrap3

Mainly used development tools

Backend: VisualStudio2013 + SQLServer2008

Front-end: WebStorm8

 

1. Create backend project AngularJs_WebApi 1.1 create an empty solution name AngularJs_WebApi

1.2 create an AngularJs_WebApi_Server server project

 

1.3 select an empty WebApi project and create

1.4 create a controller TestController class (for testing)

 

1.5 compile the implementation code of TestController. cs.
Using System. net. http; using System. web. http; namespace AngularJs_WebApi_Server.Controllers {public class TestController: ApiController {public HttpResponseMessage Get () {return new HttpResponseMessage () {Content = new StringContent ("I requested through Get ")};} public HttpResponseMessage Post () {return new HttpResponseMessage () {Content = new StringContent ("I requested via Post") };} public HttpResponseMessage Put () {return new HttpResponseMessage () {Content = new StringContent ("I requested through Put ")};}}}
1.6 test the service just released through the Chrome application REST Console (if not, download it from the App Store)

Test Get requestHttp: // localhost: 31194/api/test

Enter our request address and Method

View returned results

Test Post requestHttp: // localhost: 31194/api/test

Enter our request address and Method

View returned results

Test Put requestHttp: // localhost: 31194/api/test

Enter our request address and Method

View returned results

 

(To be continued)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.