diff --git "a/\345\215\242\346\200\235\346\207\277/20241119_\350\257\276\345\240\202\347\254\224\350\256\260+\344\275\234\344\270\232.md" "b/\345\215\242\346\200\235\346\207\277/20241119_\350\257\276\345\240\202\347\254\224\350\256\260+\344\275\234\344\270\232.md" new file mode 100644 index 0000000000000000000000000000000000000000..68969434c5b06888e0b1b234a0b7d57df1d7544e --- /dev/null +++ "b/\345\215\242\346\200\235\346\207\277/20241119_\350\257\276\345\240\202\347\254\224\350\256\260+\344\275\234\344\270\232.md" @@ -0,0 +1,136 @@ +# 笔记 +[HttpBody] +public lactionResult 方法名([fromBody]类){retrun Content(类.参数名)} +# 作业 +## Linux练习 +### 任务1 +**SSH客户端:** 网络协议客户端,免费(软件本身),命令行操作,基础SSH功能,命令行界面,依赖具体实现和配置,需要自定义配置和脚本的用户 +**Tabby应用:** 跨平台终端工具,免费(软件本身),高度可定制,支持多种协议和自定义配置,图形化界面,界面简洁优美,提供基本安全功能,可自定义安全设置,需要跨平台支持、高度可定制性和图形化界面的用户 +**Xshell:** SSH客户端软件,商业软件(需购买许可),功能强大,提供会话管理、脚本录制等高级功能, 图形化界面,功能布局清晰,提供基本安全功能,可能需要额外配置以满足高安全性需求,专业用户和企业环境,需要处理大量会话和高级功能的用户 +**Putty:** SSH客户端软件,免费,功能相对较少,但易于上手,图形化界面,界面简洁直观,提供基本加密和认证机制,初学者和只需要基本SSH功能的用户 +### 任务2 +apt update命令在Linux系统中扮演着至关重要的角色,它帮助确保你的系统能够获取到最新的软件包信息,并维护系统的安全性和稳定性。通过定期执行这个命令,你可以保持你的系统始终处于健康状态,并适应软件源的变化。因此,在进行任何软件管理操作之前,建议先运行apt update命令来更新软件包列表。 +### 任务3 +apt upgrade -y命令在维护Linux系统的安全性和稳定性方面发挥着重要作用,是系统管理员和日常用户应该定期执行的任务之一 +### 任务4 +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/1124-linux.gif) +### 任务5 +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/20241124162354.png) +## MVC练习1-12 +``` +1.命令:dotnet new console ;会生成一个.scproj和program.cs文件,.csproj项目名称和文件夹名有关 +2,3.命令:dotnet new console -n Blog -o Blog +4,5.命令:dotnet new mvc -n Mymvc -o Vlog +6.命令: 1-dotnet new sln -n Mysln + 2-dotnet new mvc -n LSYmvc -o LSY + 3-dotnet sln MySln.sln add LSY/LSYmvc.csproj + 4-dotnet new classlib -n Clb1 -o Clb1 + -dotnet sln .\Mysln.sln add .\Clb1\Clb1.csproj + 5-dotnet new classlib -n Clb2 -o Clb2 + -dotnet sln .\Mysln.sln add .\Clb2\Clb2.csproj + 6-dotnet new classlib -n Clb3 -o Clb3 + -dotnet sln .\Mysln.sln add .\Clb3\Clb3.csproj +--------- +7.代码:在homecontroller.cs填写 public IActionResult Ok() + { + return View(); + } + 在views中打开home,添加一个ok.cshtml里面填写内容 + 使用dotnet run,打开地址,http://localhost:5253/home/ok +--------- +8.代码:在controllers中打开添加一个文件名为Blogs.cs,填写 + using Microsoft.AspNetCore.Mvc; + namespace Blog.Controllers; + public class Blogs:Controller{ + public IActionResult Index(){ + return View(); + } + } +打开views并添加一个文件夹名为Blogs,在Blogs里添加一个Index.cshtml文件,并填写 神级预判 +---------- +9.代码:打开blog.cs在里面填写 + public IActionResult Music(){ + return View();} +打开views打开blogs添加一个Music.cshtml,填写 顶级打野 +----------- +10.代码:打开blog.cs在里面填写 + public IActionResult List(){ + return View();} +打开views打开blogs并添加一个List.cshtml,填写 +@* 增删改查页面 *@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
序号班级姓名年龄性别编辑
123级5班卢思懿20
223级5班郭梦媛20
323级5班陈凯杰19
+------------ +11.代码:打开controllers添加Products.cs,打开填写 + using Microsoft.AspNetCore.Mvc; + namespace Blog.Controllers; + public class Products:Controller{ + public IActionResult Edit(int id){ + return Content(id.ToString()); + } + } +//打开Views添加一个Products文件夹,在里面添加一个Edit.cshtml文件 +-------------- +12.代码:打开Products.cs,填写 + public IActionResult Create(Students student){ + student.Name = "卢思懿"; + return Content($"学生姓名:{student.Name}"); + } +添加一个学生类 public class Students + { + public string Name { get; set;} = null!; + public int Age { get; set; } + public double Height { get; set;} + } +``` +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/1124.gif) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/65f401ada2e57100687fd5a7779a922.png) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/b2af349b67e11466d8f7e9affbf02d4.png) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/683ded2fd2ed98dc7e734cfe9c4e15c.png) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/5a2e3351aa7e7fa0d23afdfb18fc9e5.png) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/de84cf8f69bb0ee47c41e06a2f4597b.png) \ No newline at end of file diff --git "a/\345\215\242\346\200\235\346\207\277/20241121_\350\257\276\345\240\202\347\254\224\350\256\260.md" "b/\345\215\242\346\200\235\346\207\277/20241121_\350\257\276\345\240\202\347\254\224\350\256\260.md" new file mode 100644 index 0000000000000000000000000000000000000000..26150dbefb9e6dbaff10b02d91eb84311f2bf2f9 --- /dev/null +++ "b/\345\215\242\346\200\235\346\207\277/20241121_\350\257\276\345\240\202\347\254\224\350\256\260.md" @@ -0,0 +1,21 @@ +# 笔记 +``` + public IActionResult Index(int id) + { return Content(id.ToString()); + } +dotnet run----http://localhost:xxxx/blog/index/?id=值 + +在program.cs项目中的 pattern: "{controller=Home}/{action=Index}/{id?}"; +将"id"修改为其它名,在方法里才能接受其他名的参数 + +public IActionResult Create(){ +var 对象名 = new 类名{ +name=“”, +author=“”, +···· +}; +return View(对象名) +} +然后在create.cshtml写@model Blog.Controllers.类名(BlogCreateDto); +@Model.对象(name/height/age) +``` \ No newline at end of file diff --git "a/\345\215\242\346\200\235\346\207\277/20241122_\350\257\276\345\240\202\347\254\224\350\256\260+\344\275\234\344\270\232.md" "b/\345\215\242\346\200\235\346\207\277/20241122_\350\257\276\345\240\202\347\254\224\350\256\260+\344\275\234\344\270\232.md" new file mode 100644 index 0000000000000000000000000000000000000000..b13d7eee8c5a79bd93bc118bdd6df7e49b8b7e63 --- /dev/null +++ "b/\345\215\242\346\200\235\346\207\277/20241122_\350\257\276\345\240\202\347\254\224\350\256\260+\344\275\234\344\270\232.md" @@ -0,0 +1,37 @@ +# 笔记 +### 序列化 +``` +在ASP.NET Core中,序列化是将对象转换为JSON或XML格式的过程,以便可以轻松地通过HTTP传输或存储在文本文件中。 +反序列化是将JSON或XML格式的数据转换回对象的过程。 +ASP.NET Core通常使用内置的System.Text.Json库或流行的Newtonsoft.Json库来处理序列化和反序列化 +``` +### 重定向 return RedirectToAction() +### 视图 +在同一个控制器下的方法,可以打开的是1页面但是显示的是2.cshtml内容: +public IActionResult 1(){ +return View("2"); +} + +# 作业 +### 专项练习-控制器传参 +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/20241124193923.png) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/20241124194017.png) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/20241124194053.png) +### 专项练习-基础能力 +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/20241124211916.png) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/1124-8-1.gif) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/1124-8-2.gif) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/20241124212050.png) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/1124-8-3.gif) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/20241124212149.png) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/1124-8-4.gif) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/20241124212252.png) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/1124-8-5.gif) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/20241124212343.png) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/1124-8-6.gif) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/20241124212430.png) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/20241124212508.png) +### 专项练习-控制器返回值 +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/20241124212907.png) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/de84cf8f69bb0ee47c41e06a2f4597b.png) +![](https://gitee.com/lu-siyi-641/gitee-image-warehouse/raw/master/photos/20241124212508.png)