/// <summary> /// This method will ask the event info from the user. /// </summary> /// <param name="logic"><see cref="IAdminstratorLogic"/>.</param> public static void AddEvent(IAdminstratorLogic logic) { if (logic == null) { throw new ArgumentNullException(nameof(logic)); } Console.WriteLine("Enter Event Name: "); string name = Console.ReadLine(); Console.WriteLine("Enter Place Name: "); string place = Console.ReadLine(); Console.WriteLine("Enter Organizer Name: "); string organizerName = Console.ReadLine(); Console.WriteLine("Enter Start Date: "); string startDate = Console.ReadLine(); Console.WriteLine("Enter End Date: "); string endDate = Console.ReadLine(); Console.WriteLine("Enter the Entry Fee: "); int entryFee = int.Parse(Console.ReadLine()); logic.Add(name, organizerName, endDate, startDate, place, entryFee); }
/// <summary> /// This method will generate the result with list of tickets brought by single guest. /// </summary> /// <param name="logic"><see cref="IAdminstratorLogic"/>.</param> public static void TicketsByGuest(IAdminstratorLogic logic) { if (logic == null) { throw new ArgumentNullException(nameof(logic)); } var result = logic.GetTicketByGuestAsync().Result; foreach (var item in result) { Console.WriteLine(item); } Console.ReadLine(); }
/// <summary> /// This method will list the no of males and females in the event. /// </summary> /// <param name="logic"><see cref="IAdminstratorLogic"/>.</param> public static void NoOfMalesFemales(IAdminstratorLogic logic) { if (logic == null) { throw new ArgumentNullException(nameof(logic)); } var result = logic.GetNoOfMalesAsync(); foreach (var item in result.Result) { Console.WriteLine(item); } Console.ReadLine(); }
/// <summary> /// This method will ask the user Ticket Id which needs to be removed. /// </summary> /// <param name="logic"><see cref="IAdminstratorLogic"/>.</param> public static void RemoveTicket(IAdminstratorLogic logic) { if (logic == null) { throw new ArgumentNullException(nameof(logic)); } Console.WriteLine("Enter Ticket Id: "); int id = int.Parse(Console.ReadLine()); if (logic.RemoveTicket(id)) { Console.WriteLine("Ticket has been Deleted"); } else { Console.WriteLine("Ticket Doesn't exits."); } Console.ReadKey(); }
/// <summary> /// This method will ask the user Event Id which needs to be removed. /// </summary> /// <param name="logic"><see cref="IAdminstratorLogic"/>.</param> public static void RemoveEvent(IAdminstratorLogic logic) { if (logic == null) { throw new ArgumentNullException(nameof(logic)); } Console.WriteLine("Enter Event Id: "); int id = int.Parse(Console.ReadLine()); if (logic.RemoveEvent(id)) { Console.WriteLine("Event has been Deleted"); } else { Console.WriteLine("No such event exists"); } Console.ReadKey(); }
/// <summary> /// This method will ask the user Guest Id and Guest name which needs to be updated.. /// </summary> /// <param name="logic"><see cref="IAdminstratorLogic"/>.</param> public static void UpdateName(IAdminstratorLogic logic) { if (logic == null) { throw new ArgumentNullException(nameof(logic)); } Console.WriteLine("Enter Guest Id: "); int id = int.Parse(Console.ReadLine()); Console.WriteLine("Enter New Guest Name: "); string name = Console.ReadLine(); if (logic.ChangeName(id, name)) { Console.WriteLine("Updated Successfully"); } else { Console.WriteLine("No Guest found with this ID"); } }
/// <summary> /// This method will ask the user Event Id and Place name which needs to be updated.. /// </summary> /// <param name="logic"><see cref="IAdminstratorLogic"/>.</param> public static void UpdatePlace(IAdminstratorLogic logic) { if (logic == null) { throw new ArgumentNullException(nameof(logic)); } Console.WriteLine("Enter Event Id"); int id = int.Parse(Console.ReadLine()); Console.WriteLine("Enter new Event Place"); string place = Console.ReadLine(); if (logic.UpdatePlace(id, place)) { Console.WriteLine("Updated Succesfully"); } else { Console.WriteLine("No Event exits with this event Id."); } }
/// <summary> /// This method will ask for the input to change the discount on the ticket. /// </summary> /// <param name="logic"><see cref="IAdminstratorLogic"/>.</param> public static void ChangeDiscount(IAdminstratorLogic logic) { if (logic == null) { throw new ArgumentNullException(nameof(logic)); } Console.WriteLine("Enter ticket ID: "); int id = int.Parse(Console.ReadLine()); Console.WriteLine("Enter the new Discount Value: "); int value = int.Parse(Console.ReadLine()); if (logic.ChangeTicketDiscount(id, value)) { Console.WriteLine("Updated Successfully"); } else { Console.WriteLine("No ticket found with this ID."); } }