Skip to content

Commit 6cc6b36

Browse files
committed
Fixed issue on update method
1 parent 847345f commit 6cc6b36

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

OnionArchitecture/OA.Service/Features/CustomerFeatures/Commands/UpdateCustomerCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ public async Task<int> Handle(UpdateCustomerCommand request, CancellationToken c
3737
}
3838
else
3939
{
40-
var customer = new Customer();
41-
customer.CustomerName = request.CustomerName;
42-
customer.ContactName = request.ContactName;
40+
cust.CustomerName = request.CustomerName;
41+
cust.ContactName = request.ContactName;
42+
_context.Customers.Update(cust);
4343
await _context.SaveChangesAsync();
4444
return cust.Id;
4545
}

OnionArchitecture/OA/Controllers/CustomerController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public async Task<IActionResult> Delete(int id)
4141
}
4242

4343

44-
[HttpPut("[action]")]
44+
[HttpPut("{id}")]
4545
public async Task<IActionResult> Update(int id, UpdateCustomerCommand command)
4646
{
4747
if (id != command.Id)

0 commit comments

Comments
 (0)