public void edit() { Console.WriteLine("\n\t╔══════════════════════════════╗"); Console.WriteLine("\t║ EDITING A JOB ║"); Console.WriteLine("\t╚══════════════════════════════╝"); Console.WriteLine("\n\tWhich one would you like to edit? (type the id)"); Console.Write("\n\t>>"); int idToEdit = Convert.ToInt32(Console.ReadLine()); Job specific = searchById(idToEdit); if (specific != null) { Console.WriteLine("{0}{1}", "\n\tID: ", specific.IdJob); Console.WriteLine("{0}{1}", "\tName: ", specific.JobName); Console.Write("\n\tNew job name: "); specific.JobName = Console.ReadLine(); Seerializer.serializeJobs(jobList, "Jobs.xml"); Console.WriteLine("\n\t╔════════════════════════════════════╗"); Console.WriteLine("\t║ JOB EDITED SUCCESSFULLY ║"); Console.WriteLine("\t╚════════════════════════════════════╝"); Console.ReadKey(); } else { Console.WriteLine("\n\t╔═══════════════════════════════════════════════════╗"); Console.WriteLine("\t║ THE JOB YOU WANT TO EDIT WAS NOT FOUND ║"); Console.WriteLine("\t╚═══════════════════════════════════════════════════╝"); Console.ReadKey(); } }
public void delete() { Console.WriteLine("\n\t╔════════════════════════════╗"); Console.WriteLine("\t║ DELETING A JOB ║"); Console.WriteLine("\t╚════════════════════════════╝"); Console.WriteLine("\n\tWhich one would you like to delete? (type the id)"); Console.Write("\n\t>>"); int idToDelete = Convert.ToInt32(Console.ReadLine()); Job itemToRemove = jobList.SingleOrDefault(r => r.IdJob == idToDelete); if (itemToRemove != null) { jobList.Remove(itemToRemove); Seerializer.serializeJobs(jobList, "Jobs.xml"); Console.WriteLine("\n\t╔════════════════════════════════════╗"); Console.WriteLine("\t║ JOB DELETED SUCCESSFULLY ║"); Console.WriteLine("\t╚════════════════════════════════════╝"); Console.ReadKey(); } else { Console.WriteLine("\n\t╔═══════════════════════════════════════════════════╗"); Console.WriteLine("\t║ THE JOB YOU WANT TO DROP WAS NOT FOUND ║"); Console.WriteLine("\t╚═══════════════════════════════════════════════════╝"); Console.ReadKey(); } }
public void add() { Console.WriteLine("\n\t╔══════════════════════════════╗"); Console.WriteLine("\t║ ADDING A NEW JOB ║"); Console.WriteLine("\t╚══════════════════════════════╝"); idJob++; job = new Job(); job.IdJob = idJob; Console.Write("\n\tJob name: "); job.JobName = Console.ReadLine(); jobList.Add(job); Seerializer.serializeJobs(jobList, "Jobs.xml"); Console.WriteLine("\n\t╔════════════════════════════════════╗"); Console.WriteLine("\t║ NEW JOB ADDED SUCCESSFULLY ║"); Console.WriteLine("\t╚════════════════════════════════════╝"); Console.ReadKey(); }