Skip to content

Instantly share code, notes, and snippets.

@aidanmorgan
Created June 22, 2011 12:16
Show Gist options
  • Save aidanmorgan/1039958 to your computer and use it in GitHub Desktop.
Save aidanmorgan/1039958 to your computer and use it in GitHub Desktop.
public IList<WhiskeyDTO> FindWhiskeyForRegion(Guid regionId)
{
using (IUnitOfWork uow = _factory.Create("WhiskeyService.FindWhiskeyForRegion"))
{
Region r = uow.RegionRepository.FindById(regionId);
IList<WhiskeyDTO> result = new List<WhiskeyDTO>();
if (r == null)
{
throw new ArgumentException(string.Format("Cannot find whiskey for Region {0} as it does not exist.", regionId), "regionId");
}
foreach (Distillery d in r.Distilleries)
{
foreach (Whiskey w in d.Whiskeys)
{
result.Add(WhiskeyDTO.Create(w));
}
}
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment