-
Notifications
You must be signed in to change notification settings - Fork 3
kailin parking lot api #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
||
if (pageIndex < 0) | ||
{ | ||
throw new PageInfoInvalidException(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good:throw exception in service
well:
|
To be improved:
|
[HttpPost] | ||
public async Task<ActionResult<ParkingLotDto>> CreateParkingLotAsync([FromBody] ParkingLotDto parkingLotDto) | ||
{ | ||
//try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: remove dead code
@@ -0,0 +1,6 @@ | |||
namespace ParkingLotApi.Exceptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well: nice to define customized exception
|
||
namespace ParkingLotApi.Filters | ||
{ | ||
public class PageInfoInvalidExceptionFilter : IActionFilter, IOrderedFilter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well: nice to add more than one exception filter
{ | ||
public class PageInfoInvalidExceptionFilter : IActionFilter, IOrderedFilter | ||
{ | ||
int IOrderedFilter.Order => int.MaxValue - 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: this value might need to be different for each filter
public Task<ParkingLot> GetParkingLotById(string id); | ||
public Task DeleteParkingLotById(string id); | ||
public Task<List<ParkingLot>> GetParkingLotByPageInfo(int pageIndex, int pageSize); | ||
public Task<List<ParkingLot>> GetAllParkingLot(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: there is no requirement for getting all data
|
||
public async Task<List<ParkingLot>> GetParkingLotByPageInfo(int pageIndex) | ||
{ | ||
int pageSize = 15; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: this variable can be extracted as constant
No description provided.