private async Task InitializeOrderAsync(OrderRequest orderRequest, Order order) { var address = Accessor.HttpContext.Connection.RemoteIpAddress.ToString(); IPInfoResponse ipInfoAddress = await IPInfo.GetLocation(address); orderRequest.OrderItems.ForEach(x => order.OrderItem.Add(Mapper.Map <OrderItem>(x))); order.ShippingAddress = orderRequest.Country + "," + orderRequest.City + "," + orderRequest.StreetAddress; order.IpinfoAddress = ipInfoAddress.Country + "," + ipInfoAddress.City; order.OrderStatus = "pending"; await OrderRepository.CreateAsync(order); }
//------------------------------------------------------------------------- void _onUCenterGetIpAddress(UCenterResponseStatus status, IPInfoResponse response, UCenterError error) { EbLog.Note("ClientSampleApp._onUCenterGetIpAddress() UCenterResult=" + status); if (error != null) { EbLog.Note("ErrorCode=" + error.ErrorCode); EbLog.Note("ErrorMessage=" + error.Message); } else if (status == UCenterResponseStatus.Success) { EbLog.Note("Code=" + response.Code); EbLog.Note("Area=" + response.Content.Area); EbLog.Note("City=" + response.Content.City); EbLog.Note("Country=" + response.Content.Country); EbLog.Note("Region=" + response.Content.Region); EbLog.Note("IP=" + response.Content.IP); } }