提交 61bf0f42 编写于 作者: 麦壳饼's avatar 麦壳饼

fix data post

上级 9e220b4b
...@@ -62,7 +62,8 @@ namespace IoTSharp.Hub.Controllers ...@@ -62,7 +62,8 @@ namespace IoTSharp.Hub.Controllers
{ {
return BadRequest(); return BadRequest();
} }
customer.Tenant = _context.Tenant.Find(customer.Tenant.Id); var customer1 = _context.Customer.Find(customer.Id);
customer.Tenant = customer1.Tenant;
_context.Entry(customer).State = EntityState.Modified; _context.Entry(customer).State = EntityState.Modified;
try try
{ {
...@@ -88,7 +89,8 @@ namespace IoTSharp.Hub.Controllers ...@@ -88,7 +89,8 @@ namespace IoTSharp.Hub.Controllers
[HttpPost] [HttpPost]
public async Task<ActionResult<Customer>> PostCustomer(Customer customer) public async Task<ActionResult<Customer>> PostCustomer(Customer customer)
{ {
customer.Tenant = _context.Tenant.Find(customer.Tenant.Id); var customer1 = _context.Customer.Find(customer.Id);
customer.Tenant = customer1.Tenant;
_context.Customer.Add(customer); _context.Customer.Add(customer);
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
return await GetCustomer(customer.Id); return await GetCustomer(customer.Id);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册