public CreateEditInformativeMenuPage(InformativeMenu menu = null, string _locationId = "", int?total = null)
        {
            InitializeComponent();

            locationId = _locationId;

            _menu = menu;

            if (_menu == null)
            {
                LoadTotals();
                this.Title          = AppResource.lblCreateMenu;
                swtActive.IsToggled = true;
                _menu = new InformativeMenu();
            }
            else
            {
                isEdit                  = true;
                this.Title              = AppResource.lblEditMenu;
                txtName.Text            = _menu.Name;
                txtTitle.Text           = _menu.Title;
                txtBody.Text            = _menu.Body;
                txtUrl.Text             = _menu.Url;
                swtActive.IsToggled     = !_menu.IsDisabled;
                txtPosition.Text        = _menu.OrderingNumber.ToString();
                lblTotalPositions.Text += _menu.TotalItens;
            }

            this.BindingContext = _menu;
        }
        public async void LoadCompany()
        {
            try
            {
                Acr.UserDialogs.UserDialogs.Instance.ShowLoading(AppResource.alertLoading);
                ShowLoading(true);
                lblAddress.Text = Company.Address;
                lblPhone.Text   = Company.Cellphone;

                var resultMenus = await service.GetInformativeMenuById(_menuId);

                var menus = JsonConvert.DeserializeObject <InformativeMenu>(resultMenus);

                _menu          = menus;
                imgUser.Source = _menu.ImageUri;

                LoadMenus();
            }
            catch (Exception ex)
            {
            }
            finally
            {
                ShowLoading(false);
                Acr.UserDialogs.UserDialogs.Instance.HideLoading();
            }
        }
        public async void LoadMenu(string id)
        {
            if (!string.IsNullOrEmpty(id))
            {
                CompanyService locationService = new CompanyService();

                try
                {
                    Acr.UserDialogs.UserDialogs.Instance.ShowLoading(AppResource.alertLoading);

                    var result = await locationService.GetInformativeMenuById(id);

                    _menu = JsonConvert.DeserializeObject <InformativeMenu>(result);
                }
                catch (Exception ex)
                {
                    this.DisplayAlert(MocoApp.Resources.AppResource.alertAlert, ex.Message, AppResource.textOk);
                }
                finally
                {
                    Acr.UserDialogs.UserDialogs.Instance.HideLoading();
                }
            }

            if (_menu == null)
            {
                LoadTotals();
                this.Title          = AppResource.lblCreateMenu;
                swtActive.IsToggled = true;
                _menu = new InformativeMenu();
            }
            else
            {
                isEdit                  = true;
                this.Title              = AppResource.lblEditMenu;
                txtName.Text            = _menu.Name;
                txtTitle.Text           = _menu.Title;
                txtBody.Text            = _menu.Body;
                txtUrl.Text             = _menu.Url;
                swtActive.IsToggled     = !_menu.IsDisabled;
                txtPosition.Text        = _menu.OrderingNumber.ToString();
                lblTotalPositions.Text += _menu.TotalItens;
            }

            this.BindingContext = _menu;
        }
        public async void Create()
        {
            try
            {
                Acr.UserDialogs.UserDialogs.Instance.ShowLoading(AppResource.alertLoading);



                InformativeMenu menu = new InformativeMenu();
                if (imageStream != null)
                {
                    //faz upload da imagem
                    ApiService service = new ApiService();
                    menu.ImageUri = await service.UploadImage(imageStream);
                }
                menu.Title           = txtTitle.Text;
                menu.Body            = txtBody.Text;
                menu.Url             = txtUrl.Text;
                menu.Name            = txtName.Text;
                menu.IsDisabled      = !swtActive.IsToggled;
                menu.OrderingNumber  = Convert.ToInt32(txtPosition.Text);
                menu.CompanyId       = Helpers.Settings.DisplayUserCompany;
                menu.LocationId      = locationId;
                menu.CategoryGroupId = _group.Id;

                var result = await companyService.CreateInformativeMenu(menu);

                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();
            }
        }