public IActionResult Delete(string KodeBarang) { try { barangDAL.Delete(KodeBarang); return(Ok($"Barang Kode {KodeBarang} berhasil dihapus")); } catch (System.Exception ex) { return(BadRequest(ex.Message)); } }
public async Task Delete(string id) { BarangDAL barangDal = new BarangDAL(); try { await barangDal.Delete(id); } catch (Exception ex) { throw new Exception(ex.Message); } }
// DELETE: api/Kategori/5 public IHttpActionResult Delete(string id) { BarangDAL barangDAL = new BarangDAL(); try { barangDAL.Delete(id); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public ActionResult Delete(int?id) { if (id != null) { using (BarangDAL service = new BarangDAL()) { try { service.Delete(id.Value); TempData["Pesan"] = Helpers.Message.GetPesan("Sukses !", "success", "Data buku berhasil didelete !"); } catch (Exception ex) { TempData["Pesan"] = Helpers.Message.GetPesan("Error !", "danger", ex.Message); } } } return(RedirectToAction("Index")); }