This commit is contained in:
454313500@qq.com
2021-03-20 21:56:15 +08:00
parent 2e5b991db0
commit 367f8f8830
16 changed files with 240 additions and 50 deletions

View File

@@ -1,4 +1,5 @@
using CC.Yi.IBLL;
using CC.Yi.Model;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
@@ -20,11 +21,50 @@ namespace CC.Yi.API.Controllers
_logger = logger;
}
#region
//下面,经典的 增删改查 即为简易--Yi意框架
//注意:请确保你的数据库中存在合理的数据
#endregion
[HttpGet]
public IActionResult Test()
public IActionResult GetTest()//查
{
var data = _studentBll.GetAllEntities().ToList();
return Content(Common.JsonFactory.JsonToString(data));
}
[HttpGet]
public IActionResult AddTest()//增
{
List<student> students = new List<student>() {new student { name = "学生a" } ,new student { name="学生d"} };
_studentBll.Add(students);
return Content("ok");
}
[HttpGet]
public IActionResult RemoveTest()//删
{
if (_studentBll.Delete(u=>u.name=="学生a"))
{
return Content("ok");
}
else
{
return Content("no");
}
}
[HttpGet]
public IActionResult UpdateTest()//改
{
if (_studentBll.Update(new student { id=2, name = "学生a" }, "name"))
{
return Content("ok");
}
else
{
return Content("no");
}
}
}
}