Skip to content

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

mechcodeman
Copy link

No description provided.

Copy link

@lklgithub lklgithub left a 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();
}

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]

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

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)

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

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)

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

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)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants