-
Notifications
You must be signed in to change notification settings - Fork 3
homework-pengyu #6
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
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
commit message easy to read
good code smell
need to better
method name should be clearer
await _parkingLotsService.DeleteAsync(name); | ||
return NoContent(); | ||
} | ||
|
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.
suggest move code logic to service layer
return NoContent(); | ||
} | ||
|
||
[HttpGet] |
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.
controller not use pageSize
using Microsoft.AspNetCore.Mvc.Filters; | ||
using ParkingLotApi.Exceptions; | ||
|
||
namespace ParkingLotApi.Filters |
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.
suggest add some exceptions such as pageIndexInvalidException
} | ||
|
||
[HttpGet] | ||
public async Task<ActionResult<ParkingLotDto>> Get(int? pageSize, int? pageIndex) |
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.
suggest method name is ***Async in controller
|
||
namespace ParkingLotApi.Services | ||
{ | ||
public interface IParkingLotsService |
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 interface can be removed, since there is only one class derived from it.
} | ||
|
||
[HttpGet] | ||
public async Task<ActionResult<ParkingLotDto>> Get(int? pageSize, int? pageIndex) |
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: use int instead of int?, since there is no requirement to get all data
@@ -1,6 +1,6 @@ | |||
using Microsoft.AspNetCore.Mvc; | |||
|
|||
namespace ParkingLotApi.Controllers | |||
namespace ParkingLotApi.Dtos |
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: namespace should be ParkingLotApi.Controllers, since it's a Controller
await parkingLotsRepository.DeleteParkingLot(parkingLotName); | ||
} | ||
|
||
public async Task<List<ParkingLot>> GetPage(int pageSize, int pageIndex) |
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: pageSize 15 should be saved in service, since it's a requirement
No description provided.