public ActionResult Edit(int? id) { Hall hall; HallRepository hallRep = new HallRepository(); if (!id.HasValue) { hall = new Hall(); } else { hall = hallRep.GetByID(id.Value); if (hall==null) { return RedirectToAction("List"); } } HallsEditVM model = new HallsEditVM(); model.ID = hall.ID; model.Name = hall.Name; model.LocationID = hall.LocationID; model.Locations = GetLocations(); return View(model); }
public ActionResult Edit() { HallsEditVM model = new HallsEditVM(); TryUpdateModel(model); HallRepository hallRep = new HallRepository(); if (!ModelState.IsValid) { model.Locations = GetLocations(); return View(model); } Hall hall; if (model.ID==0) { hall = new Hall(); } else { hall = hallRep.GetByID(model.ID); if (hall==null) { return RedirectToAction("List"); } } hall.ID = model.ID; hall.Name = model.Name; hall.LocationID = model.LocationID; hallRep.Save(hall); return RedirectToAction("List"); }
public HallHandler(IMapper mapper, HallRepository repository, SeatRepository seatRepository, ShowRepository showRepository) { _mapper = mapper; _repository = repository; _seatRepository = seatRepository; _showRepository = showRepository; }
public ActionResult Delete(int id) { HallRepository hallRep = new HallRepository(); hallRep.Delete(id); return RedirectToAction("List"); }
public HallController(UserManager <ApplicationUser> userManager, HallRepository hallRepository, CinemaRepository cinemaRepository, CompanyRepository companyRepository, UserSessionRepository userSessionRepository) { _userManager = userManager; _hallRepository = hallRepository; _cinemaRepository = cinemaRepository; _companyRepository = companyRepository; _userSessionRepository = userSessionRepository; }
public RepositoryService() { customerRepository = new CustomerRepository(); hallRepository = new HallRepository(); movieRepository = new MovieRepository(); seanceRepository = new SeanceRepository(); seatRepository = new SeatRepository(); ticketRepository = new TicketRepository(); ticketSeatRepository = new TicketSeatRepository(); userRepository = new UserRepository(); roleRepository = new RoleRepository(); }
public BaseController() { string cnnString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString(); var dbContext = new CinemaDbContext(cnnString); var actorsRepo = new ActorRepository(dbContext); _actorService = new ActorService(actorsRepo); var genreRepo = new GenreRepository(dbContext); _genreService = new GenreService(genreRepo); var hallRepo = new HallRepository(dbContext); _hallService = new HallService(hallRepo); var movieRepo = new MovieRepository(dbContext); _movieService = new MovieService(movieRepo, actorsRepo); }
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; }
public ActionResult List() { HallsListVM model = new HallsListVM(); TryUpdateModel(model); HallRepository hallRep = new HallRepository(); model.Halls = hallRep.GetAll(); if (!String.IsNullOrEmpty(model.Search)) { model.Search = model.Search.ToLower(); model.Halls = model.Halls.Where(h => h.Name.ToLower().Contains(model.Search)).ToList(); } model.Props = new Dictionary<string, object>(); switch (model.SortOrder) { case "name_desc": model.Halls = model.Halls.OrderByDescending(h => h.Name).ToList(); break; case "loc_desc": model.Halls = model.Halls.OrderByDescending(h => h.Location.Name).ToList(); break; case "loc_asc": model.Halls = model.Halls.OrderBy(h => h.Location.Name).ToList(); break; case "name_asc": default: model.Halls = model.Halls.OrderBy(h => h.Name).ToList(); break; } PagingService.Prepare(model, ControllerContext, model.Halls); return View(model); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); AuthForm f2 = new AuthForm(); ValidationField valid = new ValidationField(); string connectionStringLogin = String.Format("Server={0}; Port={1};" + "User Id={2}; Password={3}; Database={4};", DES.Decrypt("6LiCDo8gfjbrOYXuRWqbKw==", true), DES.Decrypt("ecO+kizstzM=", true), DES.Decrypt("TadpY3GnE3o=", true), DES.Decrypt("G5V2n3PhQBo=", true), DES.Decrypt("04ZE2yXOXwww9p6ZbFbp9A==", true) ); LoginRepository loginRepository = new LoginRepository(connectionStringLogin); LoginService loginService = new LoginService(loginRepository); LoginPresenter loginPresenter = new LoginPresenter(f2, loginService); Application.Run(f2); /*============================================================================================*/ switch (loginPresenter.Vacant) { case "admin": { AdminForm f1 = new AdminForm(); string connectionString = String.Format("Server={0}; Port={1};" + "User Id={2}; Password={3}; Database={4};", DES.Decrypt("6LiCDo8gfjbrOYXuRWqbKw==", true), DES.Decrypt("ecO+kizstzM=", true), "admin", DES.Decrypt("hfeeVI+gSGA=", true), DES.Decrypt("04ZE2yXOXwww9p6ZbFbp9A==", true) ); FilmsRepository filmsRepository = new FilmsRepository(connectionString); FilmsService filmsService = new FilmsService(filmsRepository); AdminFilms adminFilms = new AdminFilms(f1, filmsService, valid); SessionRepository sessionRepository = new SessionRepository(connectionString); SessionService sessionService = new SessionService(sessionRepository); AdminSession adminSession = new AdminSession(f1, sessionService, filmsService, valid); TicketsRepository ticketsRepository = new TicketsRepository(connectionString); TicketsService ticketsService = new TicketsService(ticketsRepository); AdminTickets adminTickets = new AdminTickets(f1, ticketsService, valid); StaffRepository staffRepository = new StaffRepository(connectionString); StaffService staffService = new StaffService(staffRepository); AdminStaff adminStaff = new AdminStaff(f1, staffService, valid); HallRepository hallRepository = new HallRepository(connectionString); HallService hallService = new HallService(hallRepository); AdminHall adminHall = new AdminHall(f1, hallService, valid); StaffHallRepository staffhallRepository = new StaffHallRepository(connectionString); StaffHallService staffhallService = new StaffHallService(staffhallRepository); AdminStaffHall adminStaffHall = new AdminStaffHall(f1, staffhallService, staffService); Application.Run(f1); } break; case "cashier": { CashierForm f3 = new CashierForm(); string connectionString = String.Format("Server={0}; Port={1};" + "User Id={2}; Password={3}; Database={4};", DES.Decrypt("6LiCDo8gfjbrOYXuRWqbKw==", true), DES.Decrypt("ecO+kizstzM=", true), "cashier", DES.Decrypt("DvWyPJXmeps=", true), DES.Decrypt("04ZE2yXOXwww9p6ZbFbp9A==", true) ); FilmsRepositoryC filmsRepository = new FilmsRepositoryC(connectionString); FilmsServiceC filmsService = new FilmsServiceC(filmsRepository); CashierFilms cashireFilms = new CashierFilms(f3, filmsService); SessionRepositoryC sessionRepository = new SessionRepositoryC(connectionString); SessionServiceC sessionService = new SessionServiceC(sessionRepository); CashierSession cashireSession = new CashierSession(f3, sessionService); TicketsRepositoryC ticketsRepository = new TicketsRepositoryC(connectionString); TicketsServiceC ticketsService = new TicketsServiceC(ticketsRepository); CashireTickets cashireTickets = new CashireTickets(f3, ticketsService, valid); Application.Run(f3); } break; case "cleaner": { CleanerForm f4 = new CleanerForm(); string connectionString = String.Format("Server={0}; Port={1};" + "User Id={2}; Password={3}; Database={4};", DES.Decrypt("6LiCDo8gfjbrOYXuRWqbKw==", true), DES.Decrypt("ecO+kizstzM=", true), "cleaner", DES.Decrypt("DvWyPJXmeps=", true), DES.Decrypt("04ZE2yXOXwww9p6ZbFbp9A==", true) ); TimetableRepository timetableRepository = new TimetableRepository(connectionString); TimetableService timetableService = new TimetableService(timetableRepository); CleanerTimetable cashireFilms = new CleanerTimetable(f4, timetableService); Application.Run(f4); } break; } }
private IEnumerable<SelectListItem> GetHalls() { var halls = new HallRepository().GetAll() .Select(h => new SelectListItem { Value = h.ID.ToString(), Text = h.Name }); return new SelectList(halls, "Value", "Text"); }
public HallLogic(IHallContext context, IMapper mapper) { Repository = new HallRepository(context); _mapper = mapper; }