/// <summary> /// Save the <paramref name="logEntity"/> into log table /// </summary> /// <param name="logEntity"></param> /// <returns></returns> public async Task <string> SaveAsync(ShortUrlLogEntity logEntity) { // Create the TableOperation object that inserts the entity. TableOperation insertOperation = TableOperation.Insert(logEntity); var table = _tableClient.GetTableReference(TableName); // Execute the insert operation. var result = await table.ExecuteAsync(insertOperation); return(result.Etag); }
/// <summary> /// Logs a visit for the shortcode for analytics purpose /// </summary> /// <param name="shortCode">Short Code</param> /// <param name="longUrl">Long URL</param> /// <param name="userAgent">The requester's User Agent</param> /// <param name="clientIp">The client IP address</param> /// <returns></returns> public async Task LogView(string shortCode, string longUrl, string userAgent, string clientIp) { var newEntity = new ShortUrlLogEntity(shortCode, longUrl, userAgent, clientIp); await _logRepository.SaveAsync(newEntity); }