public ActionResult CreateCategories(Category cat) { using (CategoriesDAL service = new CategoriesDAL()) { try { service.Add(cat); TempData["Message"] = Helper.MsgBox.GetMsg("success", "Success! ", "Your data " + cat.CategoryName + " has been added"); } catch (Exception ex) { TempData["Message"] = Helper.MsgBox.GetMsg("danger", "Error", ex.Message); } } return(RedirectToAction("Index")); }
public ActionResult Create(Category category) { using (CategoriesDAL service = new CategoriesDAL()) { try { service.Add(category); TempData["Pesan"] = Helpers.KotakPesan.GetPesan("Sukses !", "success", "Data kategori " + category.CategoryName + " berhasil ditambah"); } catch (Exception ex) { TempData["Pesan"] = Helpers.KotakPesan.GetPesan("Error !", "danger", ex.Message); } } return(RedirectToAction("Index")); }