private async Task LogWebActionAnonymousAsync(string lowellReference, string userId, WebActionType webActionType) { try { await _sendToRabbitMQProcess.SendToRabbitMQAnonymous(new WebActionDto() { Company = 0, DateTime = DateTime.Now, Guid = userId ?? "", LowellReference = lowellReference, WebActionType = webActionType }); } catch (Exception e) { _logger.LogError(e, $"Error in WebActionLoggingService.LogWebAction ({webActionType.ToString()})"); } }
protected async Task LogWebAction(string lowellRef, string userId, WebActionType webActionType) { try { if (string.IsNullOrWhiteSpace(lowellRef) && string.IsNullOrWhiteSpace(userId)) { _logger.LogError($"Failed to send web log for WebActionId:{(int)webActionType}, as both lowell ref and user id is null or empty."); } else if (!string.IsNullOrWhiteSpace(userId) && !Guid.TryParse(userId, out var userIdAsGuid)) { _logger.LogError($"Failed to send web log for WebActionId:{(int)webActionType}, for lowell ref {lowellRef} as provided GUID for user id is invalid. user id {userId}."); } else { await _sendToRabbitMQProcess.SendToRabbitMQ(new WebActionDto() { Company = 0, DateTime = DateTime.Now, Guid = userId ?? "", LowellReference = lowellRef, WebActionType = webActionType }); } } catch (Exception e) { _logger.LogError(e, $"Error in WebActionLoggingService.LogWebAction ({webActionType.ToString()})"); } }