Beispiel #1
0
        public ActionResult Index()
        {
            //from Source to Destination
            Mapper.CreateMap<Source, Destination>();

            var source = new Source() { Child = new Child() { Number = 4 } };
            //from - to
            Destination dest = Mapper.Map<Source, Destination>(source);
            // <=>
            Destination dest1 = Mapper.Map<Destination>(source);


            //Так  как  наше  свойство  назначения  называется  ChildNumber, 
            //AutoMapper будет преобразовывать Child.Number.
            string number = dest.ChildNumber;
            return View();
        }
Beispiel #2
0
 public ViewResult Test()
 {
     var source = new Source() { Child = new Child() { Number = 4 } };
     return AutoMappedView<Destination>(source);
 }