コード例 #1
0
        public IActionResult Details(int id)
        {
            ViewBag.Categories = new SelectList(CategoryRepository.GetAll(), "Id", "Name");
            ViewBag.Genres     = new SelectList(GenreRepository.GetAll(), "Id", "Name");
            var show = ShowRepository.GetById(id);

            return(View(show));
        }
コード例 #2
0
        public IActionResult Details(int id)
        {
            var show = ShowRepository.GetById(id);

            ViewData["Category"] = CategoryRepository.GetById(show.CategoryId).Name;
            ViewData["Genre"]    = GenreRepository.GetById(show.GenreId).Name;
            return(View(show));
        }
コード例 #3
0
        public void Get_Returns_A_Show()
        {
            var expectedId = 1;

            repo.GetById(expectedId).Returns(new Show()
            {
                ShowId = expectedId
            });

            var result = underTest.Get(expectedId);

            Assert.Equal(expectedId, result.Value.ShowId);
        }
コード例 #4
0
        public async Task <TicketViewModel> BookTicket(Guid showId, Guid userId)
        {
            try
            {
                var show = await _showRepository.GetById(showId);

                if (show.Tickets.Count >= show.TicketCount)
                {
                    return(null);
                }

                return(await _ticketRepository.BookTicket(show, userId));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(null);
            }
        }
コード例 #5
0
 public async Task <Show> GetShow(Guid showId)
 {
     return(await _showRepository.GetById(showId));
 }
コード例 #6
0
        public ActionResult <Show> Get(int id)
        {
            var show = repo.GetById(id);

            return(show);
        }