Пример #1
0
        public static TModel ToModel <TModel>(this MongoBaseInfo model) where TModel : class, IEntitySet
        {
            TModel t = Mapping.Default <MongoBaseInfo, TModel>(model);

            if (model != null && t != null)
            {
                t.SetEntityPrincipal(model.User);
            }

            return(t);
        }
Пример #2
0
        public static IList <TModel> ToModels <TViewModel, TModel>(this IList <TViewModel> viewModels) where TViewModel : IViewModel
        {
            IList <TModel> t = Mapping.Default <IList <TViewModel>, IList <TModel> >(viewModels);

            foreach (var item in t)
            {
                if (t.IsNotNullOrEmpty())
                {
                    t.SetEntityPrincipal(viewModels.First().User);
                }
            }

            return(t);
        }
Пример #3
0
        public static IList <TViewModel> ToViewModels <TModel, TViewModel>(this IList <TModel> models) where TModel : IEntitySet
        {
            IList <TViewModel> t = Mapping.Default <IList <TModel>, IList <TViewModel> >(models);

            return(t);
        }
Пример #4
0
        public static TViewModel ToViewModel <TViewModel>(this IEntitySet entity) where TViewModel : class
        {
            TViewModel t = Mapping.Default <IEntitySet, TViewModel>(entity);

            return(t);
        }