public IActionResult GetSectionRow (int venueId, string sectionName, string rowName) { RowRepository rowRepo = new RowRepository(_context); var venue = _context.Venue.FirstOrDefault(v => v.VenueId == venueId); if (venue == null) { return(NotFound($"Venue '{venueId}' Not Found")); } var section = _context.Section.FirstOrDefault(s => (s.Venue.VenueId == venue.VenueId) && (s.SectionName == sectionName)); if (section == null) { return(NotFound($"Section '{sectionName}' Not Found for Venue '{venueId}'")); } var row = _context.Row.FirstOrDefault(r => (r.Section.SectionId == section.SectionId) && (r.RowName == rowName)); if (row == null) { return(NotFound($"Row '{rowName}' Not Found for Section '{sectionName}'")); } return(Ok(rowRepo.GetSectionRow(row))); }
public void SetUp() { _row = new RowBuilder() .WithId(1) .Build(); _rows = new List <Row> { _row }; _mockDataContext = new Mock <IDataContext>(); _mockDataContext.SetupGet(p => p.Rows).Returns(_rows); _repository = new RowRepository(_mockDataContext.Object); }
public UnitOfWork(CinemaContext context, FilmRepository film, FilmStoryRepository filmStory, HallRepository hall, PlaceRepository place, RowRepository row, ShowRepository show, UserRepository user) { _context = context; Films = film; FilmStory = filmStory; Halls = hall; Places = place; Rows = row; Shows = show; Users = user; }