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" )]
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<string>> CreateProduct( [FromBody] Product obj ) {
|
||||
public async Task<ActionResult<bool>> CreateProduct( [FromBody] Product obj ) {
|
||||
try {
|
||||
await _databaseService.NewProduct( obj );
|
||||
await UpdateStore();
|
||||
return "Success";
|
||||
return true;
|
||||
} catch {
|
||||
return "Failed";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Route( "api/product/update" )]
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<string>> UpdateProduct( [FromBody] Product obj ) {
|
||||
public async Task<ActionResult<bool>> UpdateProduct( [FromBody] Product obj ) {
|
||||
try {
|
||||
await _databaseService.UpdateProduct( obj );
|
||||
await UpdateStore();
|
||||
return "Success";
|
||||
return true;
|
||||
} catch {
|
||||
return "Failed";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user