public void Store(Distillery distillery) { if (!distilleryStore.Contains(distillery)) { distilleryStore.Add(distillery); } }
public List<Whisky> FindByDistillery(Distillery distillery) { var whiskies = (from w in whiskyStore where w.DistilleryId == distillery.Id select w); return whiskies.ToList(); }
public void LoadDistilleries() { var distilleryFileContent = File.ReadAllLines(DistilleryFilePath); foreach (var distilleryLine in distilleryFileContent) { var distilleryData = distilleryLine.Split(new[] {";"}, StringSplitOptions.RemoveEmptyEntries); if (distilleryData.Length == 2) { var distilleryName = distilleryData[0]; var regionName = distilleryData[1]; var distillery = new Distillery { Id = Guid.NewGuid(), Name = distilleryName, Region = (Region) Enum.Parse(typeof (Region), regionName) }; distilleryRepository.Store(distillery); } } }