protected void btnKategori_Click(object sender, EventArgs e) { KategoriDAL kategoriDAL = new KategoriDAL(); var kategori = kategoriDAL.GetKategoriWithBerita(1); lblKategori.Text += $"Kategori: {kategori.nama_kat} <br/>"; foreach (var b in kategori.Berita) { lblKategori.Text += $"Judul Berita: {b.judul_berita}"; } }
public async Task DeleteKategori(int kategoriID) { try { KategoriDAL kategoriDAL = new KategoriDAL(); await kategoriDAL.DeleteKategori(kategoriID); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task UpdateKategori(Kategori kategori) { try { KategoriDAL kategoriDAL = new KategoriDAL(); await kategoriDAL.UpdateKategori(kategori); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task Update(Kategori obj) { KategoriDAL kategoriDAL = new KategoriDAL(); try { await kategoriDAL.Update(obj); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task Delete(string id) { KategoriDAL kategoriDAL = new KategoriDAL(); try { await kategoriDAL.Delete(id); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <IEnumerable <Kategori> > GetAll() { KategoriDAL kategoriDal = new KategoriDAL(); try { return(await kategoriDal.GetAll()); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task TambahKategori(Kategori kategori) { KategoriDAL kategoriDAL = new KategoriDAL(); try { await kategoriDAL.TambahKategori(kategori); } catch (Exception ex) { throw new Exception(ex.Message); } }
// PUT: api/Kategori/5 public IHttpActionResult Put(Kategori kategori) { KategoriDAL kategoriDAL = new KategoriDAL(); try { kategoriDAL.Update(kategori); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
// DELETE: api/Kategori/5 public IHttpActionResult Delete(int id) { KategoriDAL kategoriDAL = new KategoriDAL(); try { kategoriDAL.Delete(id); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
//Sparar en kategori el updaterar en kontakt public void SaveKategori(KategoriTyp kategori) { //Valedering GetValidation((KategoriTyp)kategori); //insert eller update if (kategori.KategoriID == 0) { KategoriDAL.InsertKategori(kategori); } else { KategoriDAL.UpdateKategori(kategori); } }
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); } }
//KATEGORITYPER CACHNING /// Hämtar alla kontakttyper. /// <returns>Ett List-objekt innehållande referenser till ContactType-objekt.</returns> public IEnumerable <KategoriTyp> GetKategoriTypes(bool refresh = false) { // Försöker hämta lista med kontakttyper från cachen. var kategoriTypes = HttpContext.Current.Cache["KategoriTypes"] as IEnumerable <KategoriTyp>; // Om det inte finns det en lista med kontakttyper... if (kategoriTypes == null || refresh) { // ...hämtar då lista med kontakttyper... kategoriTypes = KategoriDAL.GetKategorier(); // ...och cachar dessa. List-objektet, inklusive alla ContactType-objekt, kommer att cachas // under 10 minuter, varefter de automatiskt avallokeras från webbserverns primärminne. HttpContext.Current.Cache.Insert("KategoriTypes", kategoriTypes, null, DateTime.Now.AddMinutes(10), TimeSpan.Zero); } // Returnerar listan med kontakttyper. return(kategoriTypes); }
public SampleModelBinding() { kategoriDal = new KategoriDAL(); }
public IEnumerable <Kategori> Get(string namaKategori) { KategoriDAL kategoriDAL = new KategoriDAL(); return(kategoriDAL.SearchByName(namaKategori)); }
public async Task <Kategori> GetKategoriByID(int kategoriID) { KategoriDAL kategoriDAL = new KategoriDAL(); return(await kategoriDAL.GetKategoriByID(kategoriID)); }
public SampleSOAP() { kategoriDAL = new KategoriDAL(); }
// GET: api/Kategori/5 public Kategori Get(int id) { KategoriDAL kategoriDAL = new KategoriDAL(); return(kategoriDAL.GetById(id)); }
// GET: api/Kategori public IEnumerable <Kategori> Get() { KategoriDAL kategoriDAL = new KategoriDAL(); return(kategoriDAL.GetAll()); }
public List <Kategori> GetAll() { kategoriDAL = new KategoriDAL(); return(kategoriDAL.GetAll().ToList()); }
//Metoder KATEGORITYP //Hämtar ALLA Kategorier public IEnumerable <KategoriTyp> GetKategorier() { return(KategoriDAL.GetKategorier()); }
public async Task <IEnumerable <Kategori> > GetAllKategori() { KategoriDAL kategoriDAL = new KategoriDAL(); return(await kategoriDAL.GetAllKategori()); }
// The return type can be changed to IEnumerable, however to support // paging and sorting, the following parameters must be added: // int maximumRows // int startRowIndex // out int totalRowCount // string sortByExpression public IQueryable <SampleEF.Data.Kategori> gvKategori_GetData() { kategoriDal = new KategoriDAL(); return(kategoriDal.GetAll()); }
//Hämtar EN kategori public KategoriTyp GetKategori(int kategoriId) { return(KategoriDAL.GetKategoriById(kategoriId)); }
public SampleADO() { kategoriDAL = new KategoriDAL(); }
//Tar bort en kategori public void DeleteKategoriTyp(KategoriTyp kategori) { KategoriDAL.DeleteKategoriTyp(kategori); }