public static CodeSession StartSessionEdit(CodeSession currentSession)
{
Console.WriteLine("\nWhen Editing Information, If you want it left the same then press ENTER to skip.");
Console.WriteLine($"\nCurrent Date Created: {currentSession.TodaysDate}");
Console.Write("Enter Corrected Date: ");
string? newDate = Console.ReadLine();
newDate = UserValidation.VerifyEmptyOrChanged(currentSession.TodaysDate, newDate);
Console.WriteLine($"\nCurrent Start Time: {currentSession.StartTime}");
Console.Write("Enter Corrected Time: ");
string? newStartTime = Console.ReadLine();
newStartTime = UserValidation.VerifyEmptyOrChanged(currentSession.StartTime, newStartTime);
Console.WriteLine($"\nCurrent End TIme: {currentSession.EndTime}");
Console.Write("Enter Corrected Time: ");
string? newEndTime = Console.ReadLine();
newEndTime = UserValidation.VerifyEmptyOrChanged(currentSession.EndTime, newEndTime);
string? newDuration = Helpers.CalculateDuration(newStartTime, newEndTime);
CodeSession updatedSession = new()
{
Id = currentSession.Id,
TodaysDate = newDate,
StartTime = newStartTime,
EndTime = newEndTime,
Duration = newDuration
};
Console.WriteLine($"New Date: {newDate}");
Console.WriteLine($"New Start Time: {newStartTime}");
Console.WriteLine($"New End Time: {newEndTime}");
Console.WriteLine($"New Duration: {newDuration}");
Console.WriteLine("\n Are You Satisfied With These Changes? Y/N");
Console.Write("Your Selection: ");
string? satisfied = Console.ReadLine().ToLower();
satisfied = UserValidation.ValidateYesNo(satisfied);
if (satisfied == "y")
{
return updatedSession;
}
else
{
Console.WriteLine("Restarting Session Edit.");
return StartSessionEdit(currentSession);
}
}
public static CodeSession StartSessionEdit(CodeSession currentSession)
{
Console.WriteLine("\nWhen Editing Information, If you want it left the same then press ENTER to skip.");
Console.WriteLine($"\nCurrent Date Created: {currentSession.TodaysDate}");
Console.Write("Enter Corrected Date: ");
string? newDate = Console.ReadLine();
newDate = UserValidation.VerifyEmptyOrChanged(currentSession.TodaysDate, newDate);
Console.WriteLine($"\nCurrent Start Time: {currentSession.StartTime}");
Console.Write("Enter Corrected Time: ");
string? newStartTime = Console.ReadLine();
newStartTime = UserValidation.VerifyEmptyOrChanged(currentSession.StartTime, newStartTime);
Console.WriteLine($"\nCurrent End TIme: {currentSession.EndTime}");
Console.Write("Enter Corrected Time: ");
string? newEndTime = Console.ReadLine();
newEndTime = UserValidation.VerifyEmptyOrChanged(currentSession.EndTime, newEndTime);
string? newDuration = Helpers.CalculateDuration(newStartTime, newEndTime);
CodeSession updatedSession = new()
{
Id = currentSession.Id,
TodaysDate = newDate,
StartTime = newStartTime,
EndTime = newEndTime,
Duration = newDuration
};
Console.WriteLine($"New Date: {newDate}");
Console.WriteLine($"New Start Time: {newStartTime}");
Console.WriteLine($"New End Time: {newEndTime}");
Console.WriteLine($"New Duration: {newDuration}");
Console.WriteLine("\n Are You Satisfied With These Changes? Y/N");
Console.Write("Your Selection: ");
string? satisfied = Console.ReadLine().ToLower();
satisfied = UserValidation.ValidateYesNo(satisfied);
if (satisfied == "y")
{
return updatedSession;
}
else
{
Console.WriteLine("Restarting Session Edit.");
return StartSessionEdit(currentSession);
}
}