Update API to follow REST
This commit is contained in:
@@ -5,16 +5,15 @@ using System.Web.Http;
|
||||
|
||||
namespace BoredCareers.Controllers {
|
||||
[ApiController]
|
||||
[Route("api/company/")]
|
||||
[Route("api/company")]
|
||||
public class CompanyController : MistoxControllerBase {
|
||||
|
||||
public CompanyController(DatabaseService db) : base(db) {}
|
||||
|
||||
[Route("get")]
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> GetCompany([FromForm] int companyID) {
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetCompany(int CompanyID) {
|
||||
if (isLoggedIn()) {
|
||||
Company? company = await _databaseService.GetCompany(companyID);
|
||||
Company? company = await _databaseService.GetCompany(CompanyID);
|
||||
if (company != null) {
|
||||
return Ok(company);
|
||||
}
|
||||
@@ -22,7 +21,6 @@ namespace BoredCareers.Controllers {
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
[Route("set")]
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> SetCompany([FromBody] Company company) {
|
||||
if (isLoggedIn()) {
|
||||
@@ -34,9 +32,8 @@ namespace BoredCareers.Controllers {
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
[Route("delete")]
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> DeleteCompany([FromForm] int CompanyID) {
|
||||
[HttpDelete]
|
||||
public async Task<IActionResult> DeleteCompany(int CompanyID) {
|
||||
if (isLoggedIn()) {
|
||||
if (await isLoggedInUserEmployeeOf(CompanyID)) {
|
||||
await _databaseService.DeleteCompany(CompanyID);
|
||||
|
||||
Reference in New Issue
Block a user