Esempio n. 1
0
        public BreederStationDataLayer.Orm.Dto.Event mapDomainToDtoObject(Event animalEvent)
        {
            IList <BreederStationDataLayer.Orm.Dto.Animal> dtoBaseAnimals = new List <BreederStationDataLayer.Orm.Dto.Animal>();

            foreach (Animal animal in animalEvent.animals)
            {
                BreederStationDataLayer.Orm.Dto.Animal dtoBaseAnimal = new BreederStationDataLayer.Orm.Dto.Animal {
                    Id = animal.Id, Name = animal.Name
                };
                dtoBaseAnimals.Add(dtoBaseAnimal);
            }

            BreederStationDataLayer.Orm.Dto.Event dtoAnimalEvent = new BreederStationDataLayer.Orm.Dto.Event
            {
                animals = dtoBaseAnimals,
                Breeder = new BreederStationDataLayer.Orm.Dto.Breeder {
                    Id = animalEvent.Breeder.Id, Login = animalEvent.Breeder.Login
                },
                Description = animalEvent.Description,
                EndDate     = animalEvent.EndDate,
                Id          = animalEvent.Id,
                StartDate   = animalEvent.StartDate
            };
            return(dtoAnimalEvent);
        }
 public BreederStationDataLayer.Orm.Dto.Animal mapDomainToDtoObject(Animal animal)
 {
     BreederStationDataLayer.Orm.Dto.Animal dtoAnimalGroup = new BreederStationDataLayer.Orm.Dto.Animal
     {
         Id          = animal.Id,
         Active      = animal.Active,
         AnimalGroup = new BreederStationDataLayer.Orm.Dto.AnimalGroup {
             Id = animal.AnimalGroup.Id, Description = animal.AnimalGroup.Description
         },
         BirthDate = animal.BirthDate,
         Cage      = new BreederStationDataLayer.Orm.Dto.Cage {
             Id = animal.Cage.Id
         },
         Food = new BreederStationDataLayer.Orm.Dto.Food {
             Id = animal.Food.Id, Name = animal.Food.Name
         },
         LastActiveDate = animal.LastActiveDate,
         Name           = animal.Name,
         Race           = animal.Race,
         Sex            = (BreederStationDataLayer.SexEnum)((int)animal.Sex)
     };
     return(dtoAnimalGroup);
 }
        public Animal mapDtoToDomainObject(BreederStationDataLayer.Orm.Dto.Animal dtoAnimal)
        {
            Animal domainAnimalGroup = new Animal
            {
                Id          = dtoAnimal.Id,
                Active      = dtoAnimal.Active,
                AnimalGroup = new AnimalGroup {
                    Id = dtoAnimal.AnimalGroup.Id, Description = dtoAnimal.AnimalGroup.Description
                },
                BirthDate = dtoAnimal.BirthDate,
                Cage      = new Cage {
                    Id = dtoAnimal.Cage.Id
                },
                Food = new Food {
                    Id = dtoAnimal.Food.Id, Name = dtoAnimal.Food.Name
                },
                LastActiveDate = dtoAnimal.LastActiveDate,
                Name           = dtoAnimal.Name,
                Race           = dtoAnimal.Race,
                Sex            = (SexEnum)(int)dtoAnimal.Sex
            };

            return(domainAnimalGroup);
        }