예제 #1
0
        /// <inheritdoc />
        public async Task AddGaUserTrafficAsync(GaTrafficModel model)
        {
            var response = await _service.AddGaUserTrafficAsync(model);

            if (response != null)
            {
                throw new Exception(response.ErrorMessage);
            }
        }
예제 #2
0
        public async Task <IActionResult> AddGaUserTraffic([FromBody] GaTrafficModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ErrorResponse.Create(ModelState.GetErrorMessage())));
            }

            var traffic = new GaTraffic
            {
                ClientId = model.ClientId,
                Source   = model.Source,
                Medium   = model.Medium,
                Campaign = model.Campaign,
                Keyword  = model.Keyword,
                Content  = model.Content
            };

            await _gaUserService.AddGaUserTrafficAsync(traffic);

            return(Ok());
        }
 /// <summary>
 /// Adds client traffic
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='model'>
 /// </param>
 public static ErrorResponse AddGaUserTraffic(this IGoogleAnalyticsWrapperAPI operations, GaTrafficModel model = default(GaTrafficModel))
 {
     return(operations.AddGaUserTrafficAsync(model).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Adds client traffic
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='model'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ErrorResponse> AddGaUserTrafficAsync(this IGoogleAnalyticsWrapperAPI operations, GaTrafficModel model = default(GaTrafficModel), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.AddGaUserTrafficWithHttpMessagesAsync(model, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }