Esempio n. 1
0
        public ActionResult AuthorsTable(int page = 1)
        {
            ModelState.AddModelError("messages", messagesAuthorTable);
            messagesAuthorTable = null;

            List <Author> filterAuthors = TempData["AuthorList"] as List <Author>;

            List <Author> authors           = filterAuthors ?? authorsDb.GetAllAuthors();
            List <Play>   plays             = playsDb.GetAllPlays();
            Hashtable     idAndCountInPlays = new Hashtable();

            authors.ForEach(author => idAndCountInPlays.Add(author.Id, plays.Where(play => play.AuthorId == author.Id).Count()));
            ViewBag.idAndCountInPlay = idAndCountInPlays;

            int sizeForPage = pageSize;

            pageSize = normalyPageSize;

            page = truePage(page, (int)Math.Ceiling((double)authors.Count / pageSize));


            return(View(authors.ToPagedList(page, pageSize)));
        }
Esempio n. 2
0
        // GET: Home
        public ActionResult Index(int page = 1)
        {
            ViewBag.Authors = authorsDb.GetAllAuthors();

            ViewBag.Genres = genresDb.GetAllGenres();

            List <DatePlay> sortedDates = datesDb.GetAllDates().OrderBy(x => x.Date).ToList();

            ViewBag.Dates = sortedDates;

            var sortedPlays = playsDb.GetAllPlays().OrderBy(a => a.Name).ToList()
                              .Where(play => sortedDates.Where(date => date.PlayId == play.Id).Count() > 0);

            page = truePage(page, (int)Math.Ceiling((double)sortedPlays.Count() / pageSize));

            return(View(sortedPlays.ToPagedList(page, pageSize)));
        }
Esempio n. 3
0
        // GET: Home
        public ActionResult Index()
        {
            IPlayDao playsDb = PlaysTableConnection.Instance;

            ViewBag.Plays = playsDb.GetAllPlays();

            IAuthorDao authorsDb = AuthorsTableConnection.Instance;

            ViewBag.Authors = authorsDb.GetAllAuthors();

            IGenreDao genresDb = GenresTableConnection.Instance;

            ViewBag.Genres = genresDb.GetAllGenres();

            IDateDao datesDb = DatesTableConnection.Instance;

            ViewBag.Dates = datesDb.GetAllDates().OrderBy(x => x.Date).ToList();

            return(View());
        }
Esempio n. 4
0
 public IEnumerable <Author> GetAllAuthors()
 {
     return(_authorDao.GetAllAuthors());
 }