public IHttpActionResult RefreshProductsFromErply()
        {
            ErplyService.EAPI api       = new ErplyService.EAPI();
            DateTime          unixYear0 = new DateTime(1970, 1, 1);
            long unixTimestamp          = DateTime.Today
                                          .Subtract(unixYear0)
                                          .Ticks;

            unixTimestamp /= TimeSpan.TicksPerSecond;
            var error = ProductService.UpdateProducts(api, (int)unixTimestamp);

            if (error.IsError)
            {
                error.Icon = ErrorIcon.None;
                var response = new HttpResponseMessage(HttpStatusCode.NotFound)
                {
                    Content      = new StringContent(error.Message),
                    ReasonPhrase = error.Message
                };
                throw new HttpResponseException(response);
            }
            else
            {
                return(Ok());
            }
        }
Пример #2
0
        public IHttpActionResult RefreshStoresFromErply()
        {
            ErplyService.EAPI api = new ErplyService.EAPI();
            var error             = ErplyService.GetStores(api);

            if (error.IsError)
            {
                error.Icon = ErrorIcon.None;
                var response = new HttpResponseMessage(HttpStatusCode.NotFound)
                {
                    Content      = new StringContent(error.Message),
                    ReasonPhrase = error.Message
                };
                throw new HttpResponseException(response);
            }
            else
            {
                return(Ok());
            }
        }