Skip to content

HW_Wang_Ke #3

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 11 commits into
base: master
Choose a base branch
from
Open

Conversation

slb-bgc-wk
Copy link

No description provided.


## Response
## 1.Updated, Return the Pet updated with Status OK ( 200 )
## 2.Not Found, Return Status Not Found ( 404 )

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be improved: we also need to design api for employee

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx, updated the apis.http design

{
List<Company> onePageCompanies = new List<Company>();
int startIdx = (int)((index - 1) * page_size);
for (int i = 0; i < page_size && (i + startIdx) < companies.Count; i++)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: we can try to use Skip Take to do the same thing

return existingCompany;
}

[HttpPost("{company_id}")]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be improved: the URL for create employee in company should be {companyId}/employees

return theCompanyToJoin == null ? NotFound($"The company with id {company_id} does not exist.") : Created("", newEmployee);
}

[HttpDelete("{company_id}/{employee_id}")]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be improved: the URL for delete employee in company should be {companyId}/employees/{employeeId}

@sjin9
Copy link

sjin9 commented Nov 7, 2023

well:

  • baby step commit
  • detailed test
  • naming reveal business intention

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