public ActionResult Delete(int courseId, int?lectureId) { if (lectureId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Lecture lecture = LectureHelper.GetById((int)lectureId); if (lecture == null) { return(HttpNotFound()); } var success = lecture.Delete(); ViewBag.Success = success; ViewBag.CourseID = courseId; return(View()); }
void LecturetOption() { string input = ""; while (true) { Console.Clear(); PrintSubmenu("Lecture"); input = Console.ReadLine(); if (checkInput.IsValidationSwitch(input) == true) { switch (int.Parse(input)) { case 1: Console.Clear(); Console.WriteLine("This is Add New Lecture Function!!"); Console.WriteLine("__________________________________"); lecture.AddNew(p); break; case 2: Console.Clear(); student.ViewAll(p); Console.ReadLine(); break; case 3: Console.Clear(); Console.Write("Enter Student ID"); string searchName = Console.ReadLine(); Console.WriteLine("____________________________________"); Console.WriteLine("Search result: "); Console.WriteLine("____________________________________"); if (checkInput.IsNotNull(searchName) > -1) { lecture.Search(searchName, p); } else { Console.WriteLine("Invailid name"); } Console.ReadLine(); break; case 4: Console.Clear(); Console.Write("Enter delete ID"); Console.WriteLine("____________________________________"); string delID = Console.ReadLine(); lecture.Delete(delID, p); Console.ReadLine(); break; case 5: Console.Clear(); Console.Write("Enter edit ID: "); Console.WriteLine("____________________________________"); string editID = Console.ReadLine(); if (checkInput.IsID(editID) > -1) { lecture.EditInformation(editID, p); } else { Console.WriteLine("That was not a valid ID"); Console.WriteLine("Do you want to continue?"); Console.ReadLine(); } break; case 6: return; default: return; } } } }