Ejemplo n.º 1
0
        public async Task <HttpClientServiceResult <string> > PlaceOrderAsync(string url, string username, ItemsModel itemsModes)
        {
            await TokenProvider.AttachAccessTokenToHeader(HttpClient, HttpContextAccessor);

            HttpResponseMessage response;

            try
            {
                var items = new TempDataHolder(username, itemsModes.Items, DateTimeOffset.UtcNow);

                var json = JsonSerializer.Serialize(items);

                //Needed to setup the body of the request
                var data = new StringContent(json, Encoding.UTF8, "application/json");

                response = await HttpClient.PostAsync(url, data);

                response.EnsureSuccessStatusCode();
            }
            catch (HttpRequestException e)
            {
                return(new HttpClientServiceResult <string>
                {
                    Content = null !,
                    StatusCode = 500, // Server Error!
                    Error = e.Message
                });
Ejemplo n.º 2
0
        public void SaveTableData()
        {
            var data = dataTable.RetreiveTableData();

            //save the data in a temp file holder
            TempDataHolder.PartialTempFileHolder = data;
            //assign the data
            TempDataHolder.DataUpdated();
            //send update message to who ever is listening
        }