public IActionResult Post(Kategori ktg) { try{ _ktg.Insert(ktg); return(Content("Data Berhasil Ditambah !")); } catch (Exception ex) { return(Content($"Error: {ex.Message}")); } }
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")); }
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")); } }