File tree Expand file tree Collapse file tree 3 files changed +21
-6
lines changed
Expand file tree Collapse file tree 3 files changed +21
-6
lines changed Original file line number Diff line number Diff line change 1- using Mediator . Net ;
2- using Microsoft . AspNetCore . Mvc ;
3-
41namespace Wax . Api . Controllers
52{
63 [ ApiController ]
@@ -32,11 +29,18 @@ public async Task<IActionResult> CreateAsync([FromBody] CreateCustomerCommand co
3229 return CreatedAtAction ( "GetList" , response ) ;
3330 }
3431
35- [ HttpPut ]
32+ [ HttpPut ( "{customerId:guid}" ) ]
3633 [ ProducesResponseType ( 204 ) ]
37- public async Task < IActionResult > UpdateAsync ( [ FromBody ] UpdateCustomerCommand command )
34+ public async Task < IActionResult > UpdateAsync ( Guid customerId , [ FromBody ] UpdateCustomerModel model )
3835 {
39- await _mediator . SendAsync ( command ) ;
36+ await _mediator . SendAsync ( new UpdateCustomerCommand
37+ {
38+ CustomerId = customerId ,
39+ Name = model . Name ,
40+ Contact = model . Contact ,
41+ Address = model . Address
42+ } ) ;
43+
4044 return NoContent ( ) ;
4145 }
4246
Original file line number Diff line number Diff line change 11// Global using directives
22
33global using Autofac ;
4+ global using Mediator . Net ;
5+ global using Microsoft . AspNetCore . Mvc ;
46global using Serilog ;
57global using Wax . Api . Extensions ;
8+ global using Wax . Api . Models ;
69global using Wax . Core ;
710global using Wax . Core . Commands . Customers ;
811global using Wax . Core . Requests ;
Original file line number Diff line number Diff line change 1+ namespace Wax . Api . Models ;
2+
3+ public class UpdateCustomerModel
4+ {
5+ public string Name { get ; set ; }
6+ public string Contact { get ; set ; }
7+ public string Address { get ; set ; }
8+ }
You can’t perform that action at this time.
0 commit comments