Пример #1
0
        public static Animal GetAnimal(Guid id)
        {
            Guard.Against.Null(id, nameof(id));

            if (AnimalList.Any(c => c.Id == id))
            {
                return(AnimalList.SingleOrDefault(c => c.Id == id));
            }

            return(null);
        }
Пример #2
0
        public static Animal GetAnimal(Guid id, string userName)
        {
            Guard.Against.Null(id, nameof(id));
            Guard.Against.NullOrEmpty(userName, nameof(userName));

            if (AnimalList.Any(c => c.Id == id && c.User.UserName.ToLower() == userName.ToLower()))
            {
                return(AnimalList.SingleOrDefault(c => c.Id == id && c.User.UserName.ToLower() == userName.ToLower()));
            }

            return(null);
        }