示例#1
0
        public KategoriPage()
        {
            InitializeComponent();
            kategoriService = new KategoriServices();

            listView.ItemSelected += ListView_ItemSelected;
            toolBarAdd.Clicked    += ToolBarAdd_Clicked;
        }
        private async void btnTambah_Clicked(object sender, EventArgs e)
        {
            KategoriServices kategoriService = new KategoriServices();
            Kategori         newKategori     = new Kategori()
            {
                KategoriNama = txtKategoriName.Text
            };

            try
            {
                await kategoriService.TambahKategori(newKategori);

                await Navigation.PopAsync();
            }
            catch (Exception ex)
            {
                await DisplayAlert("Keterangan", ex.Message, "OK");
            }
        }
示例#3
0
        private async void btnDelete_Clicked(object sender, EventArgs e)
        {
            KategoriServices kategoriServices = new KategoriServices();
            var result = await DisplayAlert("Keterangan", "Apakah anda yakin untuk delete data " + txtKategoriName.Text + " ?", "OK", "Cancel");

            if (result)
            {
                try
                {
                    await kategoriServices.DeleteKategori(Convert.ToInt32(txtKategoriID.Text));
                    await DisplayAlert("Keterangan", "Data kategori " + txtKategoriName.Text + " berhasil didelete", "OK");

                    await Navigation.PopAsync();
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }
            }
        }
示例#4
0
        private async void btnEdit_Clicked(object sender, EventArgs e)
        {
            KategoriServices kategoriService = new KategoriServices();
            Kategori         editKategori    = new Kategori
            {
                KategoriID   = Convert.ToInt32(txtKategoriID.Text),
                KategoriNama = txtKategoriName.Text
            };

            try
            {
                await kategoriService.EditKategori(editKategori);

                //await DisplayAlert("Keterangan", "Data " + txtKategoriName.Text + " berhasil diupdate !", "OK");
                await Navigation.PopAsync();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
 public CategoryController()
 {
     _kategoriServices = new KategoriServices();
 }
示例#6
0
 public HomeController()
 {
     _haberServices    = new HaberServices();
     _kategoriServices = new KategoriServices();
 }