private static void DeleteVideo() { Console.WriteLine("You chose to delete a video! " + "\nInput the name of the video you want to delete: " + "\nTo see the list of videos, input L"); string name = Console.ReadLine().Trim(); Char[] array = name.ToCharArray(); foreach (Char letter in array) { if (!Char.IsLetter(letter)) { Console.WriteLine("\nPlease input a name without special characters or numbers." + "\nWould you like to try again?" + "\nYes/No"); switch (Console.ReadLine().ToLower()) { case "yes": Console.Clear(); DeleteVideo(); break; case "no": Menu(options); break; default: Environment.Exit(0); break; } } } if (name.ToLower().Equals("l")) { Console.WriteLine("\nList of videos:\n"); foreach (Video video in bll.GetVideos()) { Console.WriteLine($"{video.Title}, {video.Date.ToShortDateString()}, {video.StoryLine}"); } Console.WriteLine("\nWould you like to go back?" + "\nYes/No");; switch (Console.ReadLine().ToLower()) { case "yes": Console.Clear(); DeleteVideo(); break; case "no": Menu(options); break; default: Environment.Exit(0); break; } } Console.WriteLine($"\nAre you sure you want to delete {name}?" + "\nYes/No"); switch (Console.ReadLine().ToLower()) { case "yes": try { bll.DeleteVideo(name); Console.WriteLine("\nThe video was deleted!"); } catch (Exception ex) { Console.WriteLine("\nThe video could not be deleted!"); } Console.WriteLine("\nWould you like to go back to the menu or exit? \nMenu/Exit"); switch (Console.ReadLine().ToLower()) { case "menu": Console.Clear(); Menu(options); break; case "exit": Environment.Exit(0); break; default: Environment.Exit(0); break; } break; case "no": Console.WriteLine("\nThe video was not deleted!"); Console.WriteLine("\nWould you like to go back to the menu or exit? \nMenu/Exit"); switch (Console.ReadLine().ToLower()) { case "menu": Console.Clear(); Menu(options); break; case "exit": Environment.Exit(0); break; default: Environment.Exit(0); break; } break; default: Environment.Exit(0); break; } }
public JsonResult DeleteVideo(int ID) { bll.DeleteVideo(ID); return(Json("")); }