예제 #1
0
        public void Delete(Student student)
        {
            try
            {
                dal.Delete(student);
            }

            catch
            {
                throw new Exception("Delete can not complete");
            }
        }
예제 #2
0
 public ActionResult DeletePost(string id)
 {
     try
     {
         var result = _student.Delete(id);
         if (result == 1)
         {
             TempData["Pesan"] = $"<span class='alert alert-success'>Berhasil mendelete data nim:{id}</span><br/><br />";
             return(RedirectToAction("Index"));
         }
         else
         {
             ViewBag.PesanError = $"<span class='alert alert-danger'>Gagal mendelete data student</span>";
             return(View());
         }
     }
     catch (Exception ex)
     {
         ViewBag.PesanError = $"<span class='alert alert-danger'>{ex.Message}</span>";
         return(View());
     }
 }
예제 #3
0
 public void Delete(int id)
 {
     db.Delete(id);
 }
예제 #4
0
 public bool Delete(student student)
 {
     return(studentDAL.Delete(student));
 }