Commit 1ac943e4 authored by hasan khaddour's avatar hasan khaddour

fix s .

parent a76ddddb
......@@ -17,22 +17,22 @@ namespace PSManagement.Api.Controllers.Customers
[Authorize]
public class CustomersController : ControllerBase
{
private readonly ISender _sender;
private readonly IMediator _sender;
public CustomersController(ISender sender)
public CustomersController(IMediator sender)
{
_sender = sender;
}
[HttpPost]
public async Task<IActionResult> CreateCustomer(Guid userId, Guid subscriptionId, CreateCustomerRequest request)
public async Task<IActionResult> CreateCustomer(CreateCustomerRequest request)
{
Address address = new Address(request.City,request.StreetName,request.ZipCode,request.StreetNumber);
var command = new CreateCustomerCommand(request.CustomerName,address);
var result = await _sender.Send(command);
return result;
return Ok(result);
}
}
}
......@@ -14,9 +14,9 @@ namespace PSManagement.Application.Customers.UseCases.Commands.CreateCustomer
public class CreateCustomerCommandHandler : ICommandHandler<CreateCustomerCommand, Result<int>>
{
private readonly ICustomersRepository _customerRepository;
public CreateCustomerCommandHandler()
public CreateCustomerCommandHandler(ICustomersRepository customerRepository)
{
_customerRepository = customerRepository;
}
public async Task<Result<int>> Handle(CreateCustomerCommand request, CancellationToken cancellationToken)
{
......
......@@ -12,6 +12,7 @@
<ItemGroup>
<PackageReference Include="MediatR" Version="5.1.0" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="5.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" />
</ItemGroup>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment