Work around nullable ints
This commit is contained in:
@@ -26,7 +26,7 @@ namespace BoredCareers.Controllers {
|
||||
public async Task<IActionResult> SetCompany([FromBody] Company company, [FromQuery] bool newCompany = false) {
|
||||
if (isLoggedIn()) {
|
||||
if (newCompany) {
|
||||
Company? test = await _databaseService.GetCompany(company.ID);
|
||||
Company? test = await _databaseService.GetCompany(Convert.ToInt32(company.ID));
|
||||
if (test == null) {
|
||||
company.ID = await _databaseService.SetCompany(company);
|
||||
await _databaseService.SetEmployee(new Employee() {
|
||||
@@ -37,7 +37,7 @@ namespace BoredCareers.Controllers {
|
||||
}
|
||||
return NotFound("The company already exists");
|
||||
} else {
|
||||
if (await isLoggedInUserEmployeeOf(company.ID)) {
|
||||
if (await isLoggedInUserEmployeeOf(Convert.ToInt32(company.ID))) {
|
||||
await _databaseService.SetCompany(company);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace BoredCareers.Controllers {
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> SetEmployee([FromBody] Employee employee) {
|
||||
if (isLoggedIn()) {
|
||||
if (await isLoggedInUserEmployeeOf(employee.Company.ID)) {
|
||||
if (await isLoggedInUserEmployeeOf(Convert.ToInt32(employee.Company.ID))) {
|
||||
await _databaseService.SetEmployee(employee);
|
||||
return Ok();
|
||||
}
|
||||
@@ -48,7 +48,7 @@ namespace BoredCareers.Controllers {
|
||||
if (isLoggedIn()) {
|
||||
Employee? employee = await _databaseService.GetEmployee(EmployeeID);
|
||||
if (employee != null) {
|
||||
if (await isLoggedInUserEmployeeOf(employee.Company.ID)) {
|
||||
if (await isLoggedInUserEmployeeOf(Convert.ToInt32(employee.Company.ID))) {
|
||||
await _databaseService.DeleteEmployee(EmployeeID);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user