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