Example #1
0
        private Egg GetEgg(int id)
        {
            var egg = _eggRepo.GetEggWithID(id);

            if (egg == null)
            {
                throw new Exception("We couldn't find the egg you're looking for");
            }

            if (egg.Owner != GetOwner())
            {
                throw new Exception("This egg doesn't belong to the user that's logged in");
            }

            return(egg);
        }