public async Task <IActionResult> Remove(int kadraId) { try { if (User.IsInRole("Admin")) { await _kvService.DeleteKadra(kadraId); return(StatusCode(StatusCodes.Status200OK)); } else { _logger.LogError("Current user is not an admin"); return(StatusCode(StatusCodes.Status403Forbidden)); } } catch (InvalidOperationException e) { _logger.LogError(e.Message); return(StatusCode(StatusCodes.Status404NotFound)); } }
public async Task <IActionResult> Remove(int kadraId) { await _kvService.DeleteKadra(kadraId); return(StatusCode(StatusCodes.Status200OK)); }