Exemplo n.º 1
0
        protected virtual IHtmlString RenderContentPosition(ContentPosition contentPosition)
        {
            var site       = this.PageContext.PageRequestContext.Site;
            var repository = site.GetRepository();

            if (repository == null)
            {
                throw new KoobooException("The repository for site is null.");
            }
            var dataRule        = contentPosition.DataRule;
            var dataRuleContext = new DataRuleContext(this.PageContext.PageRequestContext.Site,
                                                      this.PageContext.PageRequestContext.Page)
            {
                ValueProvider = this.PageContext.PageRequestContext.GetValueProvider()
            };
            var    contentQuery = dataRule.Execute(dataRuleContext);
            string viewPath     = "";
            var    schema       = dataRule.GetSchema(repository);
            Object model        = contentQuery;

            switch (contentPosition.Type)
            {
            case ContentPositionType.Detail:
                viewPath = schema.GetFormTemplate(FormType.Detail);
                model    = contentQuery.FirstOrDefault();
                break;

            case ContentPositionType.List:
            default:
                int top = 10;
                if (int.TryParse(((FolderDataRule)dataRule).Top, out top))
                {
                    model = contentQuery.Take(top);
                }

                viewPath = schema.GetFormTemplate(FormType.List);
                break;
            }
            return(ViewRender.RenderViewInternal(this.Html, viewPath, null, model));
        }
Exemplo n.º 2
0
        protected virtual IHtmlString RenderContentPosition(ContentPosition contentPosition)
        {
            var site       = this.PageContext.PageRequestContext.Site;
            var repository = site.GetRepository();

            if (repository == null)
            {
                throw new KoobooException("The repository for site is null.");
            }
            var dataRule        = (IContentDataRule)(contentPosition.DataRule);
            var dataRuleContext = new DataRuleContext(this.PageContext.PageRequestContext.Site,
                                                      this.PageContext.PageRequestContext.Page)
            {
                ValueProvider = this.PageContext.PageRequestContext.GetValueProvider()
            };

            string        viewPath = "";
            TakeOperation operation;
            var           schema = dataRule.GetSchema(repository);

            switch (contentPosition.Type)
            {
            case ContentPositionType.Detail:
                viewPath  = schema.GetFormTemplate(FormType.Detail);
                operation = TakeOperation.First;
                break;

            case ContentPositionType.List:
            default:
                viewPath  = schema.GetFormTemplate(FormType.List);
                operation = TakeOperation.List;
                break;
            }
            var model = dataRule.Execute(dataRuleContext, operation, 0);

            return(ViewRender.RenderViewInternal(this.Html, viewPath, null, model));
        }
Exemplo n.º 3
0
 public AdminController(CampContext context, ViewRender view)
 {
     this.view = view;
     db        = context;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Renders the view.
 /// </summary>
 /// <param name="viewName">Name of the view.</param>
 /// <param name="viewData">The view data.</param>
 /// <param name="parameters">The parameters.</param>
 /// <param name="executeDataRule">if set to <c>true</c> [execute data rule].</param>
 /// <returns></returns>
 public virtual IHtmlString RenderView(string viewName, ViewDataDictionary viewData, object parameters, bool executeDataRule)
 {
     return(ViewRender.RenderView(this.Html, PageContext, viewName, viewData, parameters, executeDataRule));
 }
Exemplo n.º 5
0
 public ModalController(ViewRender view, IUserRepository userRepository)
 {
     _view           = view;
     _userRepository = userRepository;
 }
Exemplo n.º 6
0
 public MeetingController(ViewRender view)
 {
     _mailgenerator = new HtmlGenerator(view);
 }
Exemplo n.º 7
0
 public UserController(ViewRender view)
 {
     _view          = view;
     _mailgenerator = new HtmlGenerator(view);
 }
Exemplo n.º 8
0
 public ModalController(ViewRender view, IUserRepository userRepository, IMapper mapper)
 {
     _view           = view;
     _userRepository = userRepository;
     _mapper         = mapper;
 }
Exemplo n.º 9
0
 public HtmlGenerator(ViewRender viewRenderer)
 {
     ViewRenderer = viewRenderer;
 }
Exemplo n.º 10
0
 public HomeController(ViewRender view, INodeServices nodeServices)
 {
     this.view         = view;
     this.nodeServices = nodeServices;
 }