private void UpdatePet() { ShowAllPets(); Print("Select The Pet ID You Want To Edit"); int id = WaitForInt(); Print("Type New Name"); string name = WaitForString(); Print("Type New Color"); string color = WaitForString(); Print("Type New Price"); double price = WaitForInt(); Print("Type New Race"); Pet.Race race = SelectType(); Print("Type New Previous Owner"); string prewOwner = WaitForString(); Print("Type New Birth Date In Format Like : 01-01-2001"); string birthDate = WaitForString(); Print("Type New Sold Date In Format Like : 01-01-2001"); string soldDate = WaitForString(); Pet newPet = new Pet() { Name = name, Color = color, BirthDate = DateTime.Parse(birthDate), SoldDate = DateTime.Parse(soldDate), PreviousOwner = prewOwner, race = race, Price = price }; _petService.UpdatePet(id, newPet); WaitForContinue(); }
private void UpdatePet() { ShowAllPets(); Print("Select pet ID to edit"); int id = WaitForInt(); Print("Type new name"); string name = WaitForString(); Print("Type new color"); string color = WaitForString(); Print("Type new price"); double price = WaitForInt(); Print("Type new Race"); Pet.Race race = SelectType(); Print("Type new PrevOwner"); string prewOwner = WaitForString(); Print("Type new birthDate in the format : 01-01-2001"); string birthDate = WaitForString(); Print("Type new soldDate in the format : 01-01-2001"); string soldDate = WaitForString(); Pet newPet = new Pet() { Name = name, Color = color, Birthdate = DateTime.Parse(birthDate), SoldDate = DateTime.Parse(soldDate), race = race, Price = price }; _petService.UpdatePet(id, newPet); WaitForContinue(); }
private Pet.Race SelectType() { ClearConsole(); Print("Select a number"); int i = 1; foreach (Pet.Race race in Enum.GetValues(typeof(Pet.Race))) { Print($"{i}: {race}"); i++; } int number = -1; while (number < 0 || number > Enum.GetValues(typeof(Pet.Race)).Length) { number = WaitForInt(); } Pet.Race selected = (Pet.Race)Enum.GetValues(typeof(Pet.Race)).GetValue(number - 1); return(selected); }
private void CreatePet() { ClearConsole(); Print("Type Name"); string name = WaitForString(); Print("Type Color"); string color = WaitForString(); Print("Type Price"); double price = WaitForInt(); Print("Type Race"); Pet.Race race = SelectType(); Print("Type Previous Owner"); string prewOwner = WaitForString(); Print("Type Birth Date In The Format Like : 01-01-2001"); string birthDate = WaitForString(); Print("Type Sold Date In The Format Like : 01-01-2001"); string soldDate = WaitForString(); Pet newPet = new Pet() { Name = name, Color = color, BirthDate = DateTime.Parse(birthDate), SoldDate = DateTime.Parse(soldDate), PreviousOwner = prewOwner, race = race, Price = price }; _petService.CreatePet(newPet); WaitForContinue(); }