v1.0.1
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user