using GrapeCity.Forguncy.ServerApi;
using Microsoft.AspNetCore.Http;
namespace ClassLibrary2
{
public class MyAPI : ForguncyApi
{
[Post]
public async Task TestPostAPI()
{
//获取post请求的数据
var form = await Context.Request.ReadFormAsync();
var name = form["name"][0];
var department = form["department"][0];
await this.Context.Response.WriteAsync(name + department);
//使用AddTableData方法向员工表中添加数据
this.DataAccess.AddTableData("员工表", new Dictionary<string, object> { { "姓名", name }, { "部门", department } });
}
}
}
代码就是例子的,这是全部的
|