public string Chip(string name, int procedureTime) { Procedure procedure = procedureFactory.CreateProcedure("Chip"); procedure.DoService(hotel.Animals[name], procedureTime); return($"{name} had chip procedure"); }
private void DoWork(string name, int procedureTime, string procedureType) { Procedure procedure = procedureFactory.CreateProcedure(procedureType); this.currentAnimal = hotel.Animals[name]; procedure.DoService(this.currentAnimal, procedureTime); if (!procedures.ContainsKey(procedureType)) { procedures.Add(procedureType, new List <IAnimal>()); } procedures[procedureType].Add(this.currentAnimal); }
public string Chip(string name, int procedureTime) { if (!hotel.Animals.ContainsKey(name)) { throw new ArgumentException($"Animal {name} does not exist"); } IAnimal currentAnimal = hotel.Animals.First(x => x.Key == name).Value; IProcedure chip = procedureFactory.CreateProcedure("Chip"); chip.DoService(currentAnimal, procedureTime); if (!procedures.ContainsKey("Chip")) { procedures.Add("Chip", new List <IAnimal>()); } procedures["Chip"].Add(currentAnimal); return($"{currentAnimal.Name} had chip procedure"); }