예제 #1
0
        public async void Create()
        {
            try
            {
                Acr.UserDialogs.UserDialogs.Instance.ShowLoading(AppResource.alertLoading);



                Category _productCategory = new Category();
                if (imageStream != null)
                {
                    //faz upload da imagem
                    ApiService service = new ApiService();
                    _productCategory.ImageUri = await service.UploadImage(imageStream);
                }

                _productCategory.Name           = txtName.Text;
                _productCategory.IsDisabled     = !swtActive.IsToggled;
                _productCategory.LocationId     = locationId;
                _productCategory.CompanyId      = Helpers.Settings.DisplayUserCompany;
                _productCategory.OrderingNumber = Convert.ToInt32(txtPosition.Text);

                var result = await companyService.CreateProductCategory(_productCategory);

                Acr.UserDialogs.UserDialogs.Instance.Toast(AppResource.lblItemUpdatedSucess);
                await App.AppCurrent.NavigationService.GoBack();
            }
            catch (Exception ex)
            {
                this.DisplayAlert(MocoApp.Resources.AppResource.alertAlert, ex.Message, AppResource.textOk);
            }
            finally
            {
                Acr.UserDialogs.UserDialogs.Instance.HideLoading();
            }
        }