コード例 #1
0
 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());
     }
 }
コード例 #2
0
 public long Add(student student)
 {
     return(studentDAL.Insert(student));
 }