public async Task <IActionResult> ChangeStatus(Guid id) { try { Crop crop = await _repository.GetByIdAsync(id); if (crop == null) { return(NotFound()); } crop.ChangeStatus(); await _repository.UpdateAsync(crop); return(Ok()); } catch (DataStoreException e) { _logger.LogError(e.Message, e, id); return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }