public async Task DeleteAsync(Guid id) { var monitor = await _monitorRepository.GetAsync(id); if (CurrentUser.GetId() != monitor.CreatorId) { return; } await _monitorRepository.DeleteAsync(id); }
public async Task <IActionResult> DeleteMonitorAsync(Guid id) { try { await _monitorRepository.DeleteAsync(id); return(Ok()); } catch (Exception ex) { _logger.LogError($"Something went wrong inside DeleteMonitorAsynс: {ex.Message}"); return(StatusCode(500, "Internal server error.")); } }