Пример #1
0
        private async void cmdOk_Clicked(object sender, EventArgs e)
        {
            try
            {
                gridProgress.IsVisible = true;
                InventoryGroup ig = new InventoryGroup()
                {
                    Name        = InventoryGroup.Name,
                    Description = InventoryGroup.Description,
                };
                XServerApiClient client = SessionSingleton.GenXServerApiClient();
                using (SessionSingleton.HttpClient)
                {
                    switch (updateType)
                    {
                    case UpdateType.Add:

                        int id = await client.StoreInventorygroupPostAsync(ig.ToJsonString());

                        InventoryGroup.InventoryGroupId = id;
                        break;

                    case UpdateType.Update:
                        ig.InventoryGroupId = InventoryGroup.InventoryGroupId;
                        await client.StoreInventorygroupPutAsync(ig.ToJsonString());

                        break;
                    }
                }
                IsCancelled = false;
                ClosePage();
            }
            catch (Exception ex)
            {
                await App.Current.MainPage.DisplayAlert("Error", ex.Message, "OK");
            }
            finally
            {
                gridProgress.IsVisible = false;
            }
        }