Ejemplo n.º 1
0
        //[ValidateAntiForgeryToken]
        public IActionResult Delete(int id)
        {
            IActionResult result = null;

            // Are there errors
            if (!ModelState.IsValid)
            {
                result = View("Delete");
            }
            else
            {
                try
                {
                    _courseDAL.DeleteCourse(id);

                    result = RedirectToAction("Index", "Course", "");
                }
                catch (Exception ex)
                {
                    //BRP Fix, might want to redirect to an error or something.
                    result = View("Index");
                }
            }

            return(result);
        }
 /// <summary>
 /// 根据课程号,删除课程
 /// </summary>
 /// <param name="CID">课程号</param>
 /// <returns></returns>
 public bool DeleteCourse(string CID)
 {
     return(dal.DeleteCourse(CID) > 0);
 }
 /// <summary>
 /// 根据主键删除
 ///</summary>
 public static int DeleteCourse(int Id)
 {
     return(CourseDAL.DeleteCourse(Id));
 }
 // Tar bort en runda från databasen
 public void DeleteCourse(int courseId)
 {
     CourseDAL.DeleteCourse(courseId);
 }