protected void RepeaterCourse_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var CourseID = Convert.ToInt32(e.CommandArgument);

            if (e.CommandName == "Edit")
            {
                Response.Redirect("EditCourse.aspx?id=" + CourseID);
            }
            if (e.CommandName == "Delete")
            {
                CoursesService courseService = new CoursesService();
                courseService.DeleteById(CourseID);
                Response.Redirect("CourseList.aspx");
            }
            if (e.CommandName == "Details")
            {
                Response.Redirect("DetailCourse.aspx?id=" + CourseID);
            }
        }
示例#2
0
 public ActionResult Delete(int id)
 {
     coursesService.DeleteById(id);
     return(RedirectToAction("Index"));
 }