POST 中邮递员错误 - 该字段为必填项

问题描述 投票:0回答:1

有人可以帮助我,我正在尝试发送 POST 申请。但我不明白为什么它不起作用。

这是我的模型:

public partial class LineModel : IModel
    {
        public LineModel()
        {
            UsersNavigation = new HashSet<UserModel>();
            LineUsersNavigation = new HashSet<LineUserModel>();
        }
        public long Id { get; set; }
        public string ProfitCenter { get; set; }
        public string LineName { get; set; }
        public string Customer { get; set; }
        public long PlantId { get; set; }
        public long TeamId { get; set; }
        
        public virtual TeamModel TeamNavigation { get; set; }
        public virtual PlantModel PlantNavigation { get; set; }
        public virtual ICollection<UserModel> UsersNavigation { get; set; }
        public virtual ICollection<LineUserModel> LineUsersNavigation { get; set; }
    }
}

这是我的控制器:

[HttpPost]
public async Task<ActionResult<UserModel>> SaveUserAsync(UserModel user)
{
  await _dbContext.Users.AddAsync(user);
  await _dbContext.SaveChangesAsync();

  return Ok();
}

这是我的邮递员的打印

asp.net entity-framework postman http-post
1个回答
0
投票

您在请求中缺少必需的变量或未传递所有变量值

© www.soinside.com 2019 - 2024. All rights reserved.