C# 返回数据修改与前端对应
返回数据对应
- 前端数组 对 后端 list
- 前端json 对 后端 Dictionary
返回数据结构调整
- json
var data = _user.GetUserById(Convert.ToInt32(user.Id));
//2. 把新的值,赋值到就的这条数据上
data.userName = user.userName;
data.userPwd = user.userPwd;
data.explannation = user.explannation;
data.userSort = user.userSort;
data.userStatus = user.userStatus;
- 数组
XXX.Select(a =>
{
return new
{
a.id,
a.number,
a.stuName,
a.stuGrade,
createTime = Utility.FormatCreateTime(a.createTime),
a.school,
a.ranking
};
})