Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
payments
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
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
Юнусов Ибрагим
payments
Commits
50c64b42
Commit
50c64b42
authored
Jul 06, 2022
by
Юнусов Ибрагим
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил контроллеры
parent
ea760aa5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
0 deletions
+60
-0
SupplierController.cs
Payments/Payment.WebApi/Controllers/SupplierController.cs
+28
-0
UserController.cs
Payments/Payment.WebApi/Controllers/UserController.cs
+32
-0
No files found.
Payments/Payment.WebApi/Controllers/SupplierController.cs
0 → 100644
View file @
50c64b42
using
Microsoft.AspNetCore.Mvc
;
using
Payment.WebApi.Models.DbModels
;
using
Payment.WebApi.Repositories.Interfaces
;
namespace
Payment.WebApi.Controllers
;
[ApiController]
public
class
SupplierController
:
Controller
{
private
readonly
ISupplierRepository
_supplierRepository
;
public
SupplierController
(
ISupplierRepository
supplierRepository
)
{
_supplierRepository
=
supplierRepository
;
}
public
ActionResult
<
List
<
Supplier
>>
GetAll
()
{
try
{
return
Ok
(
_supplierRepository
.
GetAll
());
}
catch
(
Exception
e
)
{
return
StatusCode
(
500
,
new
{
errorMessage
=
e
.
Message
});
}
}
}
\ No newline at end of file
Payments/Payment.WebApi/Controllers/UserController.cs
0 → 100644
View file @
50c64b42
using
Microsoft.AspNetCore.Mvc
;
using
Payment.WebApi.Models.DbModels
;
using
Payment.WebApi.Repositories.Interfaces
;
namespace
Payment.WebApi.Controllers
;
[ApiController]
public
class
UserController
:
Controller
{
private
readonly
IUserRepository
_userRepository
;
public
UserController
(
IUserRepository
userRepository
)
{
_userRepository
=
userRepository
;
}
public
ActionResult
<
User
>
GetUser
(
int
id
)
{
try
{
var
user
=
_userRepository
.
GetFirstOrDefaultById
(
id
);
if
(
user
is
null
)
return
NotFound
();
return
Ok
(
user
);
}
catch
(
Exception
e
)
{
return
StatusCode
(
500
,
new
{
errorMessage
=
e
.
Message
});
}
}
}
\ No newline at end of file
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