diff --git "a/\345\220\264\344\275\263\346\225\217/20241113\350\257\276\345\240\202\347\254\224\350\256\260.md" "b/\345\220\264\344\275\263\346\225\217/20241113\350\257\276\345\240\202\347\254\224\350\256\260--Linux\345\270\270\347\224\250\345\221\275\344\273\244\344\273\245\345\217\212Mvc\345\237\272\346\234\254\347\273\223\346\236\204.md" similarity index 100% rename from "\345\220\264\344\275\263\346\225\217/20241113\350\257\276\345\240\202\347\254\224\350\256\260.md" rename to "\345\220\264\344\275\263\346\225\217/20241113\350\257\276\345\240\202\347\254\224\350\256\260--Linux\345\270\270\347\224\250\345\221\275\344\273\244\344\273\245\345\217\212Mvc\345\237\272\346\234\254\347\273\223\346\236\204.md" diff --git "a/\345\220\264\344\275\263\346\225\217/20241122\350\257\276\345\240\202\347\254\224\350\256\260--\344\274\240\351\200\222\345\217\202\346\225\260.md" "b/\345\220\264\344\275\263\346\225\217/20241122\350\257\276\345\240\202\347\254\224\350\256\260--\344\274\240\351\200\222\345\217\202\346\225\260.md" index 4d22504b1188fe2c39d6fcbe704553bcfba6b7de..4e886ae9af0192cb20754109482a154380afb12b 100644 --- "a/\345\220\264\344\275\263\346\225\217/20241122\350\257\276\345\240\202\347\254\224\350\256\260--\344\274\240\351\200\222\345\217\202\346\225\260.md" +++ "b/\345\220\264\344\275\263\346\225\217/20241122\350\257\276\345\240\202\347\254\224\350\256\260--\344\274\240\351\200\222\345\217\202\346\225\260.md" @@ -5,4 +5,11 @@ 1. 定义一个新类型 public class 类名{}---定义model实体 2. 在方法外+[httppost],在方法参数中+[FromBody]类型名---这个浏览器运行是打不开的,因为这是post请求模式 3. JsonSerializer.Serialize(类名) -4. 如上是写在控制器中,方法中写的时候要引用@model 方法位置,引用方法中的参数-Model.属性名 \ No newline at end of file +4. 如上是写在控制器中,方法中写的时候要引用@model 类型,引用方法中的参数-Model.属性名 + +# 作业 +![](./imgs/视图返回1.PNG) +![](./imgs/2.PNG) +![](./imgs/直接返回参数.PNG) +![](./imgs/传参.PNG) + diff --git "a/\345\220\264\344\275\263\346\225\217/20241125\350\257\276\345\240\202\347\254\224\350\256\260--action\350\277\224\345\233\236\345\200\274\347\261\273\345\236\213.md" "b/\345\220\264\344\275\263\346\225\217/20241125\350\257\276\345\240\202\347\254\224\350\256\260--action\350\277\224\345\233\236\345\200\274\347\261\273\345\236\213.md" new file mode 100644 index 0000000000000000000000000000000000000000..8d19412d5412b7380e604e917ccf75d1c5f1db92 --- /dev/null +++ "b/\345\220\264\344\275\263\346\225\217/20241125\350\257\276\345\240\202\347\254\224\350\256\260--action\350\277\224\345\233\236\345\200\274\347\261\273\345\236\213.md" @@ -0,0 +1,20 @@ +# Action的返回值类型 +- 定义:action是指被public修饰的修饰符 +- 返回常见数据类型,如int,string,IList<> +- IActionResult,返回相应状态码 + - 200--响应成功 + - 301--请求的资源已经被永久地移动到了一个新的位置,并且任何未来的引用都应该使用返回的URI + - 401 404--资源是否找到问题 + - 500--请求没问题,服务器内部逻辑问题 + - a.视图 + - b.重定向--RedirectToAction +- ActionResult<>,可以用时返回状态码和常规数据类型 +- JsonResult、ContentResult,返回的响应就是纯粹的数据 +- Poco 可以返回一个对象,而这个对象在被返回时会被序列化(相对应的是,反序列化)--序列化是将对象的状态信息转换为可以存储或传输的形式的过程 + +![](./imgs/11-25/1.png) +![](./imgs/11-25/2.png) +![](./imgs/11-25/3.png) +![](./imgs/11-25/4.png) +![](./imgs/11-25/5.png) +![](./imgs/11-25/6.png) \ No newline at end of file diff --git "a/\345\220\264\344\275\263\346\225\217/imgs/11-25/1.png" "b/\345\220\264\344\275\263\346\225\217/imgs/11-25/1.png" new file mode 100644 index 0000000000000000000000000000000000000000..a732f69d891ed569e58cc866c8ed1e4ce6afd2c0 Binary files /dev/null and "b/\345\220\264\344\275\263\346\225\217/imgs/11-25/1.png" differ diff --git "a/\345\220\264\344\275\263\346\225\217/imgs/11-25/2.png" "b/\345\220\264\344\275\263\346\225\217/imgs/11-25/2.png" new file mode 100644 index 0000000000000000000000000000000000000000..1cf83ab68deec4eee9feee1f214677242d5c72fe Binary files /dev/null and "b/\345\220\264\344\275\263\346\225\217/imgs/11-25/2.png" differ diff --git "a/\345\220\264\344\275\263\346\225\217/imgs/11-25/3.png" "b/\345\220\264\344\275\263\346\225\217/imgs/11-25/3.png" new file mode 100644 index 0000000000000000000000000000000000000000..deb128a01d85221201adb6a6e1736bc5d8ebd6bb Binary files /dev/null and "b/\345\220\264\344\275\263\346\225\217/imgs/11-25/3.png" differ diff --git "a/\345\220\264\344\275\263\346\225\217/imgs/11-25/4.png" "b/\345\220\264\344\275\263\346\225\217/imgs/11-25/4.png" new file mode 100644 index 0000000000000000000000000000000000000000..8a2709d392a1d81f84847d528737e858e475df9a Binary files /dev/null and "b/\345\220\264\344\275\263\346\225\217/imgs/11-25/4.png" differ diff --git "a/\345\220\264\344\275\263\346\225\217/imgs/11-25/5.png" "b/\345\220\264\344\275\263\346\225\217/imgs/11-25/5.png" new file mode 100644 index 0000000000000000000000000000000000000000..e2c7139193876d0545dcebc6fa05ddab3d8d1d69 Binary files /dev/null and "b/\345\220\264\344\275\263\346\225\217/imgs/11-25/5.png" differ diff --git "a/\345\220\264\344\275\263\346\225\217/imgs/11-25/6.png" "b/\345\220\264\344\275\263\346\225\217/imgs/11-25/6.png" new file mode 100644 index 0000000000000000000000000000000000000000..936f21e1e5099427eaeaa77668ead2991e7ad0b8 Binary files /dev/null and "b/\345\220\264\344\275\263\346\225\217/imgs/11-25/6.png" differ diff --git "a/\345\220\264\344\275\263\346\225\217/imgs/2.PNG" "b/\345\220\264\344\275\263\346\225\217/imgs/2.PNG" new file mode 100644 index 0000000000000000000000000000000000000000..7a0bb806fbfd99a031b621e191945c77eb7ac8ea Binary files /dev/null and "b/\345\220\264\344\275\263\346\225\217/imgs/2.PNG" differ diff --git "a/\345\220\264\344\275\263\346\225\217/imgs/4.png" "b/\345\220\264\344\275\263\346\225\217/imgs/4.png" new file mode 100644 index 0000000000000000000000000000000000000000..47853c6e702136177a49894a2da570f98396998d Binary files /dev/null and "b/\345\220\264\344\275\263\346\225\217/imgs/4.png" differ diff --git "a/\345\220\264\344\275\263\346\225\217/imgs/\344\274\240\345\217\202.PNG" "b/\345\220\264\344\275\263\346\225\217/imgs/\344\274\240\345\217\202.PNG" new file mode 100644 index 0000000000000000000000000000000000000000..49fb784062f3f50cb63ba8443de5d90915f02807 Binary files /dev/null and "b/\345\220\264\344\275\263\346\225\217/imgs/\344\274\240\345\217\202.PNG" differ diff --git "a/\345\220\264\344\275\263\346\225\217/imgs/\347\233\264\346\216\245\350\277\224\345\233\236\345\217\202\346\225\260.PNG" "b/\345\220\264\344\275\263\346\225\217/imgs/\347\233\264\346\216\245\350\277\224\345\233\236\345\217\202\346\225\260.PNG" new file mode 100644 index 0000000000000000000000000000000000000000..502a1b190900e7f1120876f1130779cafba60b1d Binary files /dev/null and "b/\345\220\264\344\275\263\346\225\217/imgs/\347\233\264\346\216\245\350\277\224\345\233\236\345\217\202\346\225\260.PNG" differ diff --git "a/\345\220\264\344\275\263\346\225\217/imgs/\350\247\206\345\233\276\350\277\224\345\233\2361.PNG" "b/\345\220\264\344\275\263\346\225\217/imgs/\350\247\206\345\233\276\350\277\224\345\233\2361.PNG" new file mode 100644 index 0000000000000000000000000000000000000000..6689cc528a43a8a2a955d65b7ec9d80246877abf Binary files /dev/null and "b/\345\220\264\344\275\263\346\225\217/imgs/\350\247\206\345\233\276\350\277\224\345\233\2361.PNG" differ