Пример #1
0
        private async void BtnSave_OnClicked(object sender, EventArgs e)
        {
            Overlay.IsVisible = true;

            var facilityId = ((FacilityList)EntFacility.SelectedItem).Id;

            var officer = new OfficerModel()
            {
                UserName   = EntUserName.Text,
                Department = EntDept.Text,
                FacilityId = facilityId,
                Firstname  = EntFirst.Text,
                Lastname   = EntLast.Text,
                ContactNo  = EntContactNo.Text,
                CreatedBy  = Settings.Email
            };

            var response = await _apiServices.AddOfficer(officer);

            if (!response)
            {
                Overlay.IsVisible = false;
                await DisplayAlert("Oops", "Something went wrong", "Cancel");
            }
            else
            {
                Overlay.IsVisible = false;
                await DisplayAlert("Success", "Officer added successfully", "Ok");

                await _apiServices.FacilityUserSms(officer);


                EntUserName.Text  = "";
                EntLast.Text      = "";
                EntContactNo.Text = "";
                EntFirst.Text     = "";
                EntDept.Text      = "";
                EntFacility.Items.Clear();
                await Navigation.PushAsync(new FacilityUsers());
            }
        }