Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BookHub
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Natália Marková
BookHub
Commits
0ef2b66f
There was an error fetching the commit references. Please try again later.
Commit
0ef2b66f
authored
4 months ago
by
Tomáš Zaťko
Browse files
Options
Downloads
Patches
Plain Diff
fixed ReviewController methods
parent
637542a8
No related branches found
No related tags found
2 merge requests
!31
Milestone 1
,
!25
fix: fixed ReviewController methods
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+4
-1
4 additions, 1 deletion
.gitignore
WebAPI/Controllers/ReviewController.cs
+9
-1
9 additions, 1 deletion
WebAPI/Controllers/ReviewController.cs
WebAPI/DTOs/ReviewDTO.cs
+7
-0
7 additions, 0 deletions
WebAPI/DTOs/ReviewDTO.cs
with
20 additions
and
2 deletions
.gitignore
+
4
−
1
View file @
0ef2b66f
...
...
@@ -362,4 +362,7 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd
DataAccessLayer/Migrations
\ No newline at end of file
DataAccessLayer/Migrations
/WebAPI/BookHubDB.db
/WebAPI/BookHubDB.db-shm
/WebAPI/BookHubDB.db-wal
This diff is collapsed.
Click to expand it.
WebAPI/Controllers/ReviewController.cs
+
9
−
1
View file @
0ef2b66f
...
...
@@ -84,6 +84,13 @@ namespace WebAPI.Controllers
[
Route
(
"create"
)]
public
async
Task
<
IActionResult
>
AddReview
([
FromBody
]
ReviewDTO
reviewModel
)
{
var
book
=
await
_dbContext
.
Books
.
FindAsync
(
reviewModel
.
BookId
);
if
(
book
==
null
)
{
return
BadRequest
(
"Book was not found."
);
}
// TODO: add 'var userId = await GetUserId()' when the user is logged in at the next stage of the project
var
review
=
new
Review
{
...
...
@@ -99,9 +106,10 @@ namespace WebAPI.Controllers
return
Ok
(
"Review added."
);
}
[
HttpPut
]
[
Route
(
"{id}/update"
)]
public
async
Task
<
IActionResult
>
UpdateReview
(
int
id
,
[
FromBody
]
ReviewDTO
reviewModel
)
public
async
Task
<
IActionResult
>
UpdateReview
(
int
id
,
[
FromBody
]
Update
ReviewDTO
reviewModel
)
{
var
review
=
await
_dbContext
.
Reviews
.
FindAsync
(
id
);
if
(
review
==
null
)
...
...
This diff is collapsed.
Click to expand it.
WebAPI/DTOs/ReviewDTO.cs
+
7
−
0
View file @
0ef2b66f
...
...
@@ -7,4 +7,11 @@
public
double
Rating
{
get
;
set
;
}
public
string
Description
{
get
;
set
;
}
}
public
class
UpdateReviewDTO
{
public
double
Rating
{
get
;
set
;
}
public
string
Description
{
get
;
set
;
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment