Ejemplo n.º 1
0
        public static List <PetData> GetAvailablePets()
        {
            PetRepository   petRep   = new PetRepository();
            KindRepository  kindRep  = new KindRepository();
            BreedRepository breedRep = new BreedRepository();

            List <PetData> pets = new List <PetData>();

            petRep.GetAvailablePets().ToList().ForEach(x => pets.Add(new PetData
            {
                Id           = x.Id,
                Nickname     = x.Nickname,
                KindId       = x.KindId,
                BreedId      = x.BreedId,
                Kind         = kindRep.Get(x.KindId).Name,
                Breed        = breedRep.Get(x.BreedId).Name,
                Conditions   = x.Conditions,
                ArrivalDate  = x.ArrivalDate,
                Color        = x.Color,
                HealthStatus = x.HealthStatus,
                Photos       = GetPhotos().Where(p => p.PetId == x.Id).ToList(),
                User         = null
            }));

            return(pets);
        }