コード例 #1
0
 public IActionResult Post(Kategori ktg)
 {
     try{
         _ktg.Insert(ktg);
         return(Content("Data Berhasil Ditambah !"));
     }
     catch (Exception ex) {
         return(Content($"Error: {ex.Message}"));
     }
 }
コード例 #2
0
 public IActionResult InsertPost(Kategori kategori)
 {
     try
     {
         _kategori.Insert(kategori);
         ViewData["Pesan"] = HelperAlert.GetAlert("success", "Keterangan",
                                                  $"Data kategori {kategori.NamaKategori} berhasil ditambah");
     }
     catch (Exception ex)
     {
         ViewData["Pesan"] = HelperAlert.GetAlert("danger", "Kesalahan", $"Kesalahan {ex.Message}");
     }
     return(View("Insert"));
 }
コード例 #3
0
 public IActionResult CreatePost(Kategori ktg)
 {
     try
     {
         _ktg.Insert(ktg);
         ViewData["pesan"] =
             "<span class='alert alert-success'> Data Sudah diTambah</span>";
         return(View("Create"));
     }
     catch (Exception ex)
     {
         ViewData["pesan"] =
             "<span class='alert alert-danger'> Data Gagal Ditambah, {ex.Message}</span>";
         return(View("Create"));
     }
 }