public async Task <IActionResult> DeleteModel(int id) { var model = await _modelService.GetModellByIdAsync(id); if (model == null) { return(BadRequest("Model not found")); } await _modelService.DeleteModelAsync(model); return(Ok(new { status = 200, message = "Model deleted successfully!" })); }
public async Task <IActionResult> DeleteAsync(Guid?id) { try { if (id == null) { return(BadRequest()); } await _service.DeleteModelAsync(id); } catch { return(StatusCode(500)); } return(NoContent()); }
public async Task <ActionResult> Delete(int accountId, int id) { try { Guard.AgainstAccountNumberMismatch(GetAccountIdClaim(), accountId.ToString(), "userClaim.accountId", "accountId"); await _modelService.DeleteModelAsync(accountId, id); return(Ok()); } catch (ArgumentNullException) { return(NotFound($"Error finding model {id} to delete")); } catch (AccountConflictException) { return(Forbid()); } catch (Exception) { return(Conflict($"Error deleting model {id}")); } }
public async Task <IActionResult> Delete(Guid id) { await _modelService.DeleteModelAsync(id); return(Ok()); }