public async Task <bool> CreateContact(CreateContactModel model)
        {
            var purchaseService = new XConnectService();
            var created         = await purchaseService.CreateContact(XConnectService.IdentificationSource, model.Number, model.Email);

            return(created);
        }
        public async Task <ParseDataResult> UploadClientsHistory()
        {
            try
            {
                var stream = await Request.Content.ReadAsStreamAsync();

                var customers = new ExcelImportProcessor().GetImportData(stream);

                var count = customers.Count;
                var index = 0;

                var purchaseService = new XConnectService();

                foreach (var c in customers)
                {
                    index++;
                    var added = await purchaseService.Add(c, true);

                    if (added)
                    {
                        Sitecore.Diagnostics.Log.Info($"Excel import: {index} from {count}: CustomerID={c.CustomerId}", this);
                    }
                    else
                    {
                        Sitecore.Diagnostics.Log.Error($"Excel import: {index} from {count}: CustomerID={c.CustomerId}", this);
                    }
                }

                return(new ParseDataResult
                {
                    CustomersCount = count,
                    InteractionsCount = count,
                    PurchasesCount = customers.Count
                });
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
 public XConnectApiController(XConnectService xConnectService)
 {
     _xConnectService = xConnectService;
 }