public void Seed() { Claim claim1 = new Claim(2584, "Car", "Car accident on 465", 400.00, new DateTime(2018, 4, 25), new DateTime(2018, 4, 27)); Claim claim2 = new Claim(8978, "Home", "House fire in kitchen", 4000.00, new DateTime(2018, 4, 11), new DateTime(2018, 4, 12)); Claim claim3 = new Claim(2426, "Theft", "Stolen Pancakes", 400.00, new DateTime(2018, 4, 27), new DateTime(2018, 6, 01)); _repo.AddClaim(claim1); _repo.AddClaim(claim2); _repo.AddClaim(claim3); }
private void AddClaim() { Console.Clear(); Console.WriteLine("Enter the claim ID:"); int claimID = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter the claim type:"); string claimType = Console.ReadLine(); Console.WriteLine("Enter a short description of the claim:"); string claimDescribe = Console.ReadLine(); Console.WriteLine("Enter the amount of the claim:"); double claimAmount = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Enter the date of the accident (MM/DD/YYYY): "); bool claimAccidentNotValid = true; DateTime claimAccident = new DateTime(); while (claimAccidentNotValid) { if (DateTime.TryParse(Console.ReadLine(), out claimAccident)) { claimAccidentNotValid = false; } else { Console.WriteLine("You have entered an incorrect value."); } } Console.WriteLine("Enter the date of the claim (MM/DD/YYYY):"); bool claimDateNotValid = true; DateTime claimDate = new DateTime(); while (claimDateNotValid) { if (DateTime.TryParse(Console.ReadLine(), out claimDate)) { claimDateNotValid = false; } else { Console.WriteLine("You have entered an incorrect value."); } } Claim newClaim = new Claim(claimID, claimType, claimDescribe, claimAmount, claimAccident, claimDate); _repo.AddClaim(newClaim); }