-
Notifications
You must be signed in to change notification settings - Fork 4
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
base: master
Are you sure you want to change the base?
HW_Wang_Ke #3
Conversation
…when getAll companies.
…eturn 404 not found if not existing.
…et with query pagesize and index.
…and if the company not found then return NotFound 404 status code
…turn not found if the id of company not exsiting and created if adding successfully.
…d will return no found if the id of company or employee is not exsiting.
CompanyApi/api.http
Outdated
|
||
## Response | ||
## 1.Updated, Return the Pet updated with Status OK ( 200 ) | ||
## 2.Not Found, Return Status Not Found ( 404 ) |
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.
to be improved: we also need to design api for employee
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.
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++) |
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: we can try to use Skip Take to do the same thing
return existingCompany; | ||
} | ||
|
||
[HttpPost("{company_id}")] |
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.
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}")] |
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.
to be improved: the URL for delete employee in company should be {companyId}/employees/{employeeId}
well:
|
No description provided.