关于.net core 接口拿id
public async Task<string> UserInfo( AppUserInfo model, Guid id)
{
var userinfoid=id;
var userInfo = await _appUserInfo.GetByIdAsync(id);
// var user = await _appUser.GetById(id);
// if (user != null)
// {
// user.Email = model.Email?.Trim();
// await _appUser.UpdateAsync(user);
// }
//获取接口传递的值
if (userInfo != null)
{
userInfo.Alias = model.Alias?.Trim();
userInfo.Age = model.Age?.Trim();
userInfo.Email = model.Email?.Trim();
userInfo.AobilePhoneNumber = model.AobilePhoneNumber?.Trim();
userInfo.Area = model.Area?.Trim();
userInfo.Work = model.Work?.Trim();
userInfo.Hobby = model.Hobby?.Trim();
userInfo.Design = model.Design?.Trim();
await _appUserInfo.UpdateAsync(userInfo);
var res = new
{
Code = 1000,
Data = model.Username,
Msg = "修改个人信息成功"
};
return res.SerializeObject();
解决方法:UserInfo([FromBody] AppUserInfo model, Guid id)
}