private TicketService CreateSearchService() { var options = new DbContextOptionsBuilder <BookMyTicketDBContext>() .UseInMemoryDatabase(nameof(SearchServiceTest), new InMemoryDatabaseRoot()) .ConfigureWarnings(x => x.Ignore(InMemoryEventId.TransactionIgnoredWarning)) .Options; var dbContext = new BookMyTicketDBContext(options); var cityRepository = new CitiesRepository(dbContext); var movieRepository = new MoviesRepository(dbContext); var cinemaRepository = new CinemasRepository(dbContext); var showsRepository = new ShowsRepository(dbContext); var cinemaSeatingRepository = new CinemaSeatingRepository(dbContext); var ticketsRepository = new TicketsRepository(dbContext); var reservationsRepository = new ReservationsRepository(dbContext); var configuration = new MapperConfiguration(cfg => cfg.AddProfile(new MappingProfile())); var clientContext = new ClientContext() { UserInfo = new Models.UserProfile() { ID = 1 } }; var mapper = new Mapper(configuration); MockDB(dbContext); var searchService = new SearchService(cityRepository, movieRepository, cinemaRepository, showsRepository, cinemaSeatingRepository, ticketsRepository, reservationsRepository, mapper); return(new TicketService(showsRepository, ticketsRepository, reservationsRepository, clientContext, searchService, mapper, dbContext)); }
public static ReservationsEntity GetReservationsByID(long rid) { ReservationsRepository rr = new ReservationsRepository(); ReservationsInfo info = rr.GetReservationsInfoByID(rid); return(TranslateReservationsEntity(info)); }
public ActionResult Delete(Reservation reservation) { ReservationsRepository rep = new ReservationsRepository(); rep.Delete(reservation); return(RedirectToAction("Index")); }
public UnitOfWork(ApplicationDbContext context) { _context = context; Reservations = new ReservationsRepository(context); Services = new ServiceRepository(context); Users = _context.Users.ToList(); }
public static List <ReservationsEntity> GetReservationsByRule(ReservationsSearchEntity search, PagerInfo pager) { List <ReservationsEntity> all = new List <ReservationsEntity>(); ReservationsRepository mr = new ReservationsRepository(); List <ReservationsInfo> miList = mr.GetReservationsPagerByRule(search, pager); foreach (ReservationsInfo mInfo in miList) { ReservationsEntity entity = TranslateReservationsEntity(mInfo); all.Add(entity); } return(all); }
// GET: MyReservations public ActionResult MyReservations() { if (!Request.IsAuthenticated) { return(RedirectToAction("Login", "Account")); } else { ReservationsRepository resRepo = new ReservationsRepository(); DisplayReservationsViewModel model = new DisplayReservationsViewModel(); long currentUserId = User.Identity.GetUserId <long>(); model.MyReservations = resRepo.GetReservations(currentUserId); return(View(model)); } }
// GET: Reservations public ActionResult Index() { ReservationsRepository repository = new ReservationsRepository(); ReservationsListViewModel model = new ReservationsListViewModel(); RestaurantsRepository rep = new RestaurantsRepository(); UsersRepository repo = new UsersRepository(); List <Reservation> reservations = repository.GetActive(); List <Restaurant> restaurants = rep.GetAll(); List <User> users = repo.GetAll(); model.Reservation = reservations; model.Restaurants = restaurants; model.Users = users; return(View(model)); }
private SearchService CreateSearchService() { var options = new DbContextOptionsBuilder <BookMyTicketDBContext>() .UseInMemoryDatabase(nameof(SearchServiceTest), new InMemoryDatabaseRoot()) .Options; var dbContext = new BookMyTicketDBContext(options); var cityRepository = new CitiesRepository(dbContext); var movieRepository = new MoviesRepository(dbContext); var cinemaRepository = new CinemasRepository(dbContext); var showsRepository = new ShowsRepository(dbContext); var cinemaSeatingRepository = new CinemaSeatingRepository(dbContext); var ticketsRepository = new TicketsRepository(dbContext); var reservationsRepository = new ReservationsRepository(dbContext); var productProfile = new MappingProfile(); var configuration = new MapperConfiguration(cfg => cfg.AddProfile(productProfile)); var mapper = new Mapper(configuration); MockDB(dbContext); return(new SearchService(cityRepository, movieRepository, cinemaRepository, showsRepository, cinemaSeatingRepository, ticketsRepository, reservationsRepository, mapper)); }
public ActionResult Edit(int Id) { ReservationsRepository repo = new ReservationsRepository(); Reservation dbreservation = new Reservation(); dbreservation = repo.Get(Id); ReservationsEditViewModel model = new ReservationsEditViewModel(); model.PeopleCount = dbreservation.PeopleCount; model.ReservationTime = dbreservation.ReservationTime; model.Comment = dbreservation.Comment; model.UserId = dbreservation.UserId; model.ResraurantId = dbreservation.RestaurantId; model.Id = Id; UsersRepository rep = new UsersRepository(); ViewBag.UserId = new SelectList(rep.GetAll(), "Id", "Name"); RestaurantsRepository repository = new RestaurantsRepository(); ViewBag.RestaurantId = new SelectList(repository.GetAll(), "Id", "Name"); return(View(model)); }
public ActionResult MostVisited() { MostVisitedCreateViewModel mostVisited = new MostVisitedCreateViewModel(); DateTime dateWeek = DateTime.Now.AddDays(-7); DateTime dateMonth = DateTime.Now.AddMonths(-1); DateTime dateYear = DateTime.Now.AddYears(-1); ReservationsRepository repository = new ReservationsRepository(); RestaurantsRepository rep = new RestaurantsRepository(); List <Restaurant> restaurants = rep.GetAll(); mostVisited.Restaurants = restaurants; UsersRepository repo = new UsersRepository(); List <User> users = repo.GetAll(); mostVisited.Users = users; //mostVisited.mostVisitedWeekly = repository.GetAll(n => n.ReservationTime > dateWeek && n.ReservationTime < DateTime.Now); mostVisited.mostVisitedWeekly = repository.GetAll(dateWeek); mostVisited.mostVisitedMonthly = repository.GetAll(dateMonth); mostVisited.mostVisitedYearly = repository.GetAll(dateYear); //mostVisited.mostVisitedMonthly = repository.GetAll(n => n.ReservationTime > dateMonth && n.ReservationTime < DateTime.Now); //mostVisited.mostVisitedYearly = repository.GetAll(n => n.ReservationTime > dateYear && n.ReservationTime < DateTime.Now); return(View(mostVisited)); }
public static bool AddReservations(ReservationsEntity entity) { int result = 0; ReservationsRepository rR = new ReservationsRepository(); if (entity != null) { ReservationsInfo info = new ReservationsInfo(); info.CarID = entity.CarID; info.CreateDate = DateTime.Now; info.CustomerID = entity.CustomerID; info.CustomerName = entity.CustomerName; info.LeaseTime = entity.LeaseTime; info.PayType = entity.PayType; info.Price = entity.Price; info.RDate = DateTime.Now; info.Remark = entity.Remark; info.RType = entity.RType; info.Status = entity.Status; result = rR.CreateNew(info); } return(result > 0); }
public ActionResult Create(ReservationsCreateViewModel model) { if (!ModelState.IsValid) { UsersRepository rep = new UsersRepository(); ViewBag.UserId = new SelectList(rep.GetAll(), "Id", "Name"); RestaurantsRepository repo = new RestaurantsRepository(); ViewBag.RestaurantId = new SelectList(repo.GetAll(), "Id", "Name"); return(View()); } else { Reservation reservation = new Reservation(); reservation.PeopleCount = model.PeopleCount; reservation.ReservationTime = model.ReservationTime; reservation.Comment = model.Comment; reservation.UserId = model.UserId; reservation.RestaurantId = model.ResraurantId; ReservationsRepository repository = new ReservationsRepository(); repository.Insert(reservation); return(RedirectToAction("Index")); } }
public void SetUp() { _reservationsRepository = new ReservationsRepository(); _sut = new VacantRoomsDenormalizer(_reservationsRepository); }
public Class1(ReservationsRepository reservationsRepository, IUnitOfWork unitOfWork, ITableRepositorycs tableRepositorycs) { this._reservationsRepository = reservationsRepository; this._unitOfWork = unitOfWork; _tableRepositorycs = tableRepositorycs; }
public UserReservationsController(ApiContext context) { resveReservationsRepository = new ReservationsRepository(context); }
public ReservationsManager(ReservationsRepository reservationsRepository) { _reservationsRepository = reservationsRepository; }
public AdvertisementReservationsController(ApiContext context) { resveReservationsRepository = new ReservationsRepository(context); }