public IActionResult Delete(string id) { try { if (SessionIsNull()) { return(Redirect("/Home/Login?mustLogin=true&next=/Lesson/Delete?id=" + id)); } PlanService ser = new PlanService(); int result = ser.DeleteLesson(id); SetViewBag(); if (result == 1) { return(Redirect("/Lesson/ViewLesson?delete_success=true")); } else { return(Redirect("/Lesson/ViewLesson?delete_error=true")); } } catch (Exception) { return(Redirect("/Lesson/ViewLesson?delete_error=true")); } }