Ejemplo n.º 1
0
 public IActionResult Delete(string KodeBarang)
 {
     try
     {
         barangDAL.Delete(KodeBarang);
         return(Ok($"Barang Kode {KodeBarang} berhasil dihapus"));
     }
     catch (System.Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Ejemplo n.º 2
0
        public async Task Delete(string id)
        {
            BarangDAL barangDal = new BarangDAL();

            try
            {
                await barangDal.Delete(id);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Ejemplo n.º 3
0
        // 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));
            }
        }
Ejemplo n.º 4
0
 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"));
 }