示例#1
0
        // GET: /Course/Delete/
        public ActionResult Delete(string title)
        {
            try
            {
                PLCourse Course = new PLCourse();
                Course = CourseClientService.GetCourseDetail(title);
                if (Course.prerequisiteList.Count > 0)
                {
                    for (int i = 0; i < Course.prerequisiteList.Count; i++)
                    {
                        CourseClientService.DeletePrerequisite(Course.id, Course.prerequisiteList[i].id);
                    }
                }

                bool success = CourseClientService.DeleteCourse(title);

                if (success)
                {
                    return(RedirectToAction("Index"));
                }

                return(RedirectToAction("Error"));
            }
            catch
            {
                return(RedirectToAction("Index"));//View("Index");
            }
        }
示例#2
0
 public ActionResult DeletePrerequisite(FormCollection collection)
 {
     try
     {
         int course_id = Convert.ToInt32(collection["course_id"]);
         int pre_id    = Convert.ToInt32(collection["pre_id"]);
         CourseClientService.DeletePrerequisite(course_id, pre_id);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }