国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

002.AngularJs調用Restful實現CRUD

2019-11-14 16:38:15
字體:
來源:轉載
供稿:網友

本節我們主要給大家介紹AngularJs如何調用Restful,實現數據的CRUD。

主要用到的技術:

后端:asp.net WebApi + SQLServer2008

前端:AngularJs,Bootstrap3

主要用到的開發工具

后端:VisualStudio2013 + SQLServer2008

前端:WebStorm8

 

1.創建后端項目AngularJs_WebApi

1.1建立空解決方案名稱AngularJs_WebApi

image

1.2 創建AngularJs_WebApi_Server服務端項目

image

 

1.3 選擇空的WebApi項目,并創建

image

image

1.4 新建控制器TestController類(用于測試)

image

image

image

 

1.5 編寫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("我是通過Get請求的")            };        }        public HttpResponseMessage Post()        {            return new HttpResponseMessage()            {                Content = new StringContent("我是通過Post請求的")            };        }        public HttpResponseMessage Put()        {            return new HttpResponseMessage()            {                Content = new StringContent("我是通過Put請求的")            };        }    }}

1.6 通過Chrome應用程序REST Console測試剛才發布的服務(如果沒有可以到應用商店中去下載)

image

測試Get請求http://localhost:31194/api/test

請輸入我們的請求地址和請求方式

image

查看返回結果

image

測試Post請求http://localhost:31194/api/test

請輸入我們的請求地址和請求方式

image

查看返回結果

image

測試Put請求http://localhost:31194/api/test

請輸入我們的請求地址和請求方式

image

查看返回結果

image

 

(未完待續)


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 四川省| 武鸣县| 靖西县| 花莲市| 浠水县| 辉县市| 沾化县| 二连浩特市| 景宁| 邛崃市| 柏乡县| 五指山市| 西安市| 扬州市| 墨竹工卡县| 博白县| 汉阴县| 汝阳县| 静海县| 靖西县| 泰兴市| 贡嘎县| 五寨县| 炎陵县| 博乐市| 肥城市| 保山市| 承德市| 铁岭县| 吉安市| 陈巴尔虎旗| 江都市| 北碚区| 密云县| 丰台区| 通城县| 南宫市| 松原市| 西充县| 鹤峰县| 临湘市|