Ejemplo n.º 1
0
        /// <summary>
        /// This is the default Action.
        /// </summary>
        public ActionResult Index()
        {
            var model = new AuthorsModel();

            if (string.IsNullOrEmpty(this.Title))
            {
                model.Title = "Author";
            }
            else
            {
                model.Title = this.Title;
            }
            var authors = GetAuthors().Select(i => AuthorViewModel.GetAuthorViewModel(i));

            model.Authors = authors.ToList();

            return(View("Default", model));
        }
        /// <summary>
        /// This is the default Action.
        /// </summary>
        public ActionResult Index()
        {
            var model = new AuthorsWidgetModel();

            //GET AUTHORS
            var providerName = String.Empty;
            DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(providerName);
            Type authorType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.Authors.Author");

            // This is how we get the collection of Author items
            var myCollection = dynamicModuleManager.GetDataItems(authorType).Where(i => i.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live).Take(4);

            // At this point myCollection contains the items from type authorType
            model.AvatarEnabled = this.EnableAvatar;
            model.Authors       = myCollection.Select(i => AuthorViewModel.GetAuthorViewModel(i)).ToList();

            return(View("Default", model));
        }