Use bools instead of strings for better apis
This commit is contained in:
@@ -57,25 +57,25 @@ namespace MistoxWebsite.Server.Controllers {
|
|||||||
|
|
||||||
[Route( "api/product/create" )]
|
[Route( "api/product/create" )]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<ActionResult<string>> CreateProduct( [FromBody] Product obj ) {
|
public async Task<ActionResult<bool>> CreateProduct( [FromBody] Product obj ) {
|
||||||
try {
|
try {
|
||||||
await _databaseService.NewProduct( obj );
|
await _databaseService.NewProduct( obj );
|
||||||
await UpdateStore();
|
await UpdateStore();
|
||||||
return "Success";
|
return true;
|
||||||
} catch {
|
} catch {
|
||||||
return "Failed";
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route( "api/product/update" )]
|
[Route( "api/product/update" )]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<ActionResult<string>> UpdateProduct( [FromBody] Product obj ) {
|
public async Task<ActionResult<bool>> UpdateProduct( [FromBody] Product obj ) {
|
||||||
try {
|
try {
|
||||||
await _databaseService.UpdateProduct( obj );
|
await _databaseService.UpdateProduct( obj );
|
||||||
await UpdateStore();
|
await UpdateStore();
|
||||||
return "Success";
|
return true;
|
||||||
} catch {
|
} catch {
|
||||||
return "Failed";
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user