// 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)); }
/* ş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)); }
public IActionResult AuthorList() { AuthorListViewModel authorListViewModel = new AuthorListViewModel() { Authors = _authorServices.GetAll() }; return(View(authorListViewModel)); }
public ActionResult <IEnumerable <AuthorDTO> > GetAuthors() { var authors = _authorServices.GetAll(); if (authors == null) { return(NotFound()); } return(Ok(authors)); }
public IActionResult ArticleCreateAdmin() { ViewBag.Categories = _categoryServices.GetAll(); ViewBag.Authors = _authorServices.GetAll(); return(View()); }
public IEnumerable <Author> GetAll() { return(_authorServices.GetAll()); }
public IActionResult Get() { var authorModel = _authorServices.GetAll().ToApiModels(); return(Ok(authorModel)); }