public async Task <Kategori> GetById(string id)
        {
            if (id == string.Empty)
            {
                throw new Exception("id harus diisi !");
            }

            KategoriDAL kategoriDal = new KategoriDAL();

            try
            {
                return(await kategoriDal.GetById(id));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Example #2
0
        protected void btnGetID_Click(object sender, EventArgs e)
        {
            var kategori = kategoriDAL.GetById(Convert.ToInt32(txtKategori.Text));

            txtNamaKategori.Text = kategori.nama_kat;
        }
        // GET: api/Kategori/5
        public Kategori Get(int id)
        {
            KategoriDAL kategoriDAL = new KategoriDAL();

            return(kategoriDAL.GetById(id));
        }