예제 #1
0
        public void TryMapSourceToDestination(ActionExecutedContext filterContext)
        {
            var sourceModel = filterContext.Controller.ViewData.Model;

            if (sourceModel == null)
            {
                return;
            }

            var destinationType = TypeReflector.GetDestinationModelType(filterContext);

            if (destinationType == null)
            {
                return;
            }

            var mapped = Map(sourceModel, destinationType);

            if (mapped != null)
            {
                filterContext.Controller.ViewData.Model = mapped;
            }
        }