国产探花免费观看_亚洲丰满少妇自慰呻吟_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

 

(未完待續)


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 舟山市| 故城县| 清原| 陇西县| 玉环县| 阿鲁科尔沁旗| 林州市| 聊城市| 清涧县| 尼玛县| 山阴县| 桐梓县| 永寿县| 宁德市| 宣恩县| 高尔夫| 芦山县| 正定县| 于田县| 沙雅县| 承德市| 揭西县| 西乌珠穆沁旗| 二连浩特市| 营口市| 通江县| 阳山县| 石泉县| 志丹县| 合川市| 吉木萨尔县| 万源市| 平塘县| 缙云县| 勐海县| 潼关县| 宁晋县| 曲沃县| 杨浦区| 阿巴嘎旗| 神农架林区|