Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
ProjectsStatusManagement
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hasan.bahjat
ProjectsStatusManagement
Commits
1ac943e4
Commit
1ac943e4
authored
Jul 26, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix s .
parent
a76ddddb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
6 deletions
+7
-6
CustomersController.cs
...nagement.Api/Controllers/Customers/CustomersController.cs
+4
-4
CreateCustomerCommandHandler.cs
...s/Commands/CreateCustomer/CreateCustomerCommandHandler.cs
+2
-2
PSManagement.Application.csproj
PSManagement.Application/PSManagement.Application.csproj
+1
-0
No files found.
PSManagement.Api/Controllers/Customers/CustomersController.cs
View file @
1ac943e4
...
...
@@ -17,22 +17,22 @@ namespace PSManagement.Api.Controllers.Customers
[
Authorize
]
public
class
CustomersController
:
ControllerBase
{
private
readonly
I
Sende
r
_sender
;
private
readonly
I
Mediato
r
_sender
;
public
CustomersController
(
I
Sende
r
sender
)
public
CustomersController
(
I
Mediato
r
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
)
;
}
}
}
PSManagement.Application/Customers/UseCases/Commands/CreateCustomer/CreateCustomerCommandHandler.cs
View file @
1ac943e4
...
...
@@ -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
)
{
...
...
PSManagement.Application/PSManagement.Application.csproj
View file @
1ac943e4
...
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment