public ActionResult Create(Student student) { try { var result = _student.Insert(student); if (result == 1) { TempData["Pesan"] = $"<span class='alert alert-success'>Berhasil menambah data student {student.Nama}</span><br/><br />"; return(RedirectToAction("Index")); } else { ViewBag.PesanError = $"<span class='alert alert-danger'>Gagal menambah data student {student.Nama}</span>"; return(View()); } } catch (Exception ex) { ViewBag.PesanError = $"<span class='alert alert-danger'>{ex.Message}</span>"; return(View()); } }
public long Add(student student) { return(studentDAL.Insert(student)); }