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); }
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); }