Ejemplo n.º 1
0
        // GET: Authors
        public ActionResult Index(int?id, int?bookId, string sortOrder, string searchString, string currentFilter, int pageSize = 10, int pageNumber = 1)
        {
            if (searchString == null)
            {
                searchString = currentFilter;
            }
            else
            {
                pageNumber = 1;
            }

            var model = DependencyResolver.Current.GetService <AuthorIndexViewModel>();

            //var model = new AuthorIndexViewModel();

            _parameterBuilder.Build(model, searchString: searchString, sortingParam: sortOrder, pageSize: pageSize, pageNumber: pageNumber);
            model.Authors = _services.GetAll(model.Sorting, model.Filtering, model.Paging, model.Options);

            if (id != null)
            {
                model.Id    = id.Value;
                model.Books = _bookServices.GetBooksByAuthor(model.Id);
            }

            if (bookId != null)
            {
                ViewBag.BookId = bookId;
            }

            ViewBag.LastNameSort  = String.IsNullOrEmpty(sortOrder) ? "lName_desc" : "";
            ViewBag.FirstNameSort = sortOrder == "fName" ? "fName_desc" : "fName";


            return(View(model));
        }
Ejemplo n.º 2
0
        /* şuan burası pasif
         * public IActionResult BookRead(int id)
         * {
         *  Book book = _bookService.GetBookReadDetails(id);
         *
         *  return View(new BookDetailModel()
         *  {
         *      Book = book,
         *      Category = book.BookCategories.Select(i => i.Categories).ToList()
         *
         *  });
         * } */

        public IActionResult AuthorList()
        {
            AuthorListViewModel authorListViewModel = new AuthorListViewModel()//şurayı sor () olmadanda çalışıyor neden?
            {
                Authors = _authorServices.GetAll()
            };

            return(View(authorListViewModel));
        }
Ejemplo n.º 3
0
        public IActionResult AuthorList()
        {
            AuthorListViewModel authorListViewModel = new AuthorListViewModel()
            {
                Authors = _authorServices.GetAll()
            };

            return(View(authorListViewModel));
        }
Ejemplo n.º 4
0
        public ActionResult <IEnumerable <AuthorDTO> > GetAuthors()
        {
            var authors = _authorServices.GetAll();

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

            return(Ok(authors));
        }
Ejemplo n.º 5
0
 public IActionResult ArticleCreateAdmin()
 {
     ViewBag.Categories = _categoryServices.GetAll();
     ViewBag.Authors    = _authorServices.GetAll();
     return(View());
 }
Ejemplo n.º 6
0
 public IEnumerable <Author> GetAll()
 {
     return(_authorServices.GetAll());
 }
Ejemplo n.º 7
0
        public IActionResult Get()
        {
            var authorModel = _authorServices.GetAll().ToApiModels();

            return(Ok(authorModel));
        }