Use bools instead of strings for better apis

This commit is contained in:
2025-06-27 23:09:03 -07:00
parent 45a173d6ab
commit c493513847
@@ -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;
} }
} }