Example #1
0
        public ActionResult Index(AuthorsListSuccessMessage message = AuthorsListSuccessMessage.None)
        {
            var authors = new AuthorRepository().GetAll();

            var model = Mapper.Map <IEnumerable <Author>, AuthorsListModel>(authors);

            if (message != AuthorsListSuccessMessage.None)
            {
                model.SuccessMessage = message.GetDescriptionAttributeValue();
            }

            return(View(model));
        }
        public ActionResult Index(AuthorsListSuccessMessage message = AuthorsListSuccessMessage.None)
        {
            var authors = new AuthorRepository().GetAll();
            var model = new AuthorsListModel
                            {
                                Authors = authors.Select(author => new AuthorListItemModel
                                                                       {
                                                                           Id = author.Id,
                                                                           FullName = author.FirstName + " " + author.LastName
                                                                       }).ToList()
                            };
            if (message != AuthorsListSuccessMessage.None)
                model.SuccessMessage = message.GetDescriptionAttributeValue();

            return View(model);
        }
Example #3
0
        public ActionResult Index(AuthorsListSuccessMessage message = AuthorsListSuccessMessage.None)
        {
            var authors = new AuthorRepository().GetAll();
            var model   = new AuthorsListModel
            {
                Authors = authors.Select(author => new AuthorListItemModel
                {
                    Id       = author.Id,
                    FullName = author.FirstName + " " + author.LastName
                }).ToList()
            };

            if (message != AuthorsListSuccessMessage.None)
            {
                model.SuccessMessage = message.GetDescriptionAttributeValue();
            }

            return(View(model));
        }
        public ActionResult Index(AuthorsListSuccessMessage message = AuthorsListSuccessMessage.None)
        {
            var authors = _authorRepository.GetAll();

            var model = Mapper.Map<IEnumerable<Author>, AuthorsListModel>(authors);
            if (message != AuthorsListSuccessMessage.None)
                model.SuccessMessage = message.GetDescriptionAttributeValue();

            return View(model);
        }