Created
June 16, 2011 16:13
-
-
Save aidanmorgan/1029603 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public RatingDTO GetUserRatingForWhiskey(Guid userId, Guid whiskeyId) | |
{ | |
using(IUnitOfWork uow = _unitOfWorkFactory.Create("RatingService.GetUserRatingForWhiskey")) | |
{ | |
User u = uow.UserRepository.FindById(userId); | |
Whiskey w = uow.WhiskeyRepository.FindById(whiskeyId); | |
if(u == null) | |
{ | |
throw new ArgumentException(string.Format("No User with id {0} exists.", userId)); | |
} | |
if(w == null) | |
{ | |
throw new ArgumentException(string.Format("No Whiskey with id {0} exists.", whiskeyId)); | |
} | |
return (from r in u.Ratings where r.ReviewOf.Id == whiskeyId select RatingDTO.Create(r)).FirstOrDefault(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment