private static async Task WriteEntry(int userId) { Console.WriteLine("What activity?"); string activity = Console.ReadLine(); while (string.IsNullOrWhiteSpace(activity)) { Console.WriteLine("Invalid response. Please enter a valid activity."); activity = Console.ReadLine(); } Console.WriteLine("Amount of the activity?"); string amount = Console.ReadLine(); while (string.IsNullOrWhiteSpace(amount)) { Console.WriteLine("Invalid response. Please enter a valid username."); amount = Console.ReadLine(); } Entry newEntry = new Entry() { UserId = userId, Activity = activity, Amount = amount }; await EntryHttpMethods.AddEntry(_client, newEntry); }
private static async Task GetEntry(int userId) { int entryCount; do { Console.WriteLine("How many entries would you like?"); }while (!Int32.TryParse(Console.ReadLine(), out entryCount)); List <Entry> entries = await EntryHttpMethods.GetEntries(_client, userId, entryCount); if (entries.Count == 0) { Console.WriteLine("No entries found by this user."); } else { foreach (Entry entry in entries) { Console.WriteLine($"{entry.Activity} for {entry.Amount} on {entry.Timestamp}"); } } }