Example #1
0
        public static void Map(ViewModelToDomainMappingProfile profile)
        {
            profile.CreateMap <AnimalViewModel, Animal>()
            .ConstructUsing(x =>
                            Animal.Criar(
                                x.Id,
                                x.Nome,
                                x.Tipo,
                                x.Raca,
                                x.Descricao,
                                x.Kilos,
                                x.Cor,
                                profile.Mapper.Map <ICollection <AnimalArquivo> >(x)
                                )
                            );


            profile.CreateMap <AnimalArquivoViewModel, AnimalArquivo>()
            .ConstructUsing(x =>
                            AnimalArquivo.Criar(
                                x.Id,
                                x.IdAnimal,
                                x.Nome,
                                string.IsNullOrEmpty(x.Arquivo)? null : Convert.FromBase64String(x.Arquivo)
                                )
                            );
        }
Example #2
0
 private Animal ObterAnimail()
 {
     return(Animal.Criar(
                0,
                "Hue",
                "Peidão",
                "negra",
                "dididi he",
                10,
                "#ccc",
                new List <AnimalArquivo>()
     {
         AnimalArquivo.CriarUpload(0, 0, "HUe.jpg", new byte[] { 00, 11, 22, 77, }),
         AnimalArquivo.CriarUpload(0, 0, "zz.jpg", new byte[] { 00, 11, 22, 77, })
     }
                ));
 }