Esempio n. 1
0
        public override ActionResult Index(RenderModel model)
        {
            var authorList = new AuthorListModel(model.Content);

            authorList.Authors = Umbraco.GetContentByAuthors(authorList);
            return(View(PathHelper.GetThemeViewPath(authorList, "Authors"), authorList));
        }
Esempio n. 2
0
        public async Task <IActionResult> Index()
        {
            var ListAuthor = await Mediator.Send(new AuthorQuery());

            AuthorListModel authorListModel = new AuthorListModel
            {
                ListAuthor = ListAuthor
            };

            return(View(authorListModel));
        }
Esempio n. 3
0
        public ActionResult Index()
        {
            try
            {
                var             authors = db.Authors.ToList();
                AuthorListModel model   = new AuthorListModel
                {
                    AuthorsList = AuthorRelase.GetAuthorsResult(authors)
                };

                return(View(model.AuthorsList));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
Esempio n. 4
0
        // GET: Category
        public ActionResult Index()
        {
            AuthorListModel model = new AuthorListModel
            {
                Authors = db.Authors
            };

            if (HttpContext.Request.Cookies["role"].Value.Equals("admin"))
            {
                model.Role = "admin";
            }
            else
            {
                model.Role = "user";
            }
            return(View(model));
        }
Esempio n. 5
0
        public IActionResult Index()
        {
            var authors = _author.GetAuthors().ToList();

            var authorList = authors.Select(author => new AuthorModel
            {
                Id           = author.Id,
                FirstName    = author.FirstName,
                LastName     = author.LastName,
                AddedDate    = author.AddedDate,
                EmailAddress = author.EmailAddress
            });

            AuthorListModel model = new AuthorListModel()
            {
                AuthorList = authorList
            };

            return(View(model));
        }
Esempio n. 6
0
        public virtual IActionResult List(DataSourceRequest command, AuthorListModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageAuthors))
            {
                return(AccessDeniedKendoGridJson());
            }


            var authorsModels = _authorService.GetAllAuthors(authorFirstName: model.SearchFirstName, authorLastName: model.SearchLastName, pageIndex: command.Page - 1, pageSize: command.PageSize, showHidden: true)
                                .Select(x => x.ToModel())
                                .ToList();

            var gridModel = new DataSourceResult
            {
                Data  = authorsModels,
                Total = authorsModels.Count
            };

            return(Json(gridModel));
        }
Esempio n. 7
0
        public async Task <IActionResult> Search([FromQuery] string search)
        {
            var author = await _repository.Query().Where(a => a.Name.ToLower().Contains(search.ToLower())).ToListAsync();

            if (author == null)
            {
                return(NotFound());
            }

            var result = new AuthorListModel
            {
                Authors = author.Select(a => new AuthorModel
                {
                    Id          = a.Id,
                    Name        = a.Name,
                    Description = a.Description,
                    Media       = a.Media.Path
                })
            };

            return(Ok(result));
        }
Esempio n. 8
0
        public ActionResult AuthorViewList()
        {
            var model = new AuthorListModel();

            model.dataSourceItem = Context.Database.GetItem(RenderingContext.Current.Rendering.DataSource);
            BlogSettings settingsItem = DataManager.GetBlogSettingsItem(model.dataSourceItem != null ? model.dataSourceItem : Context.Item);

            model.authorCount = AuthorManager.GetAuthorCount(model.dataSourceItem != null ? model.dataSourceItem : Context.Item);
            IEnumerable <Author> authors = null;

            if (settingsItem.OrderAuthorOnCount)
            {
                authors = AuthorManager.GetAuthorsOrderedByCount(model.authorCount);
            }
            else
            {
                authors = AuthorManager.GetAuthors(model.dataSourceItem != null ? model.dataSourceItem : Sitecore.Context.Item);
            }

            // Set max display
            authors       = AuthorManager.SetAuthorDisplayLimit(settingsItem.AuthorListMaxAuthorsToDisplay, authors);
            model.authors = authors;
            return(this.View("~/Areas/XBlog/Views/XBlog/Callouts/AuthorViewList.cshtml", model));
        }