Beispiel #1
0
        public static ActionResultModel Create(IFrameworkFacade facade, IActionFacade action, IObjectFacade nakedObject, int page, int pageSize, string format)
        {
            var  result         = nakedObject.GetDomainObject <IEnumerable>();
            Type genericType    = result.GetType().IsGenericType ? result.GetType().GetGenericArguments().First() : typeof(object);
            Type armGenericType = result is IQueryable ? typeof(ActionResultModelQ <>) : typeof(ActionResultModel <>);
            Type armType        = armGenericType.MakeGenericType(genericType);
            var  arm            = (ActionResultModel)Activator.CreateInstance(armType, action, result);

            arm.Page     = page;
            arm.PageSize = pageSize;
            arm.Format   = format;

            return(facade.Wrap(arm, nakedObject) as ActionResultModel);
        }