Example #1
0
 public TicketController(IConfiguration configuration)
 {
     context          = new MSSQLTicketContext(configuration.GetConnectionString("DefaultConnection"));
     repo             = new TicketRepository(context);
     converter        = new TicketViewModelConverter();
     stationContext   = new MSSQLStationContext(configuration.GetConnectionString("DefaultConnection"));
     stationRepo      = new StationRepository(stationContext);
     stationConverter = new StationViewModelConverter();
 }
Example #2
0
 public IActionResult Create(TicketDetailViewModel vm)
 {
     if (ModelState.IsValid)
     {
         TicketViewModelConverter ticketViewModelConverter = new TicketViewModelConverter();
         Ticket  t  = ticketViewModelConverter.ViewModelToTicket(vm);
         decimal id = repo.CreateTicket(t);
         return(RedirectToAction("Details", new { id }));
     }
     return(View());
 }
Example #3
0
 public HomeController(IConfiguration configuration)
 {
     ticketContext    = new MSSQLTicketContext(configuration.GetConnectionString("DefaultConnection"));
     ticketRepo       = new TicketRepository(ticketContext);
     ticketConverter  = new TicketViewModelConverter();
     stationContext   = new MSSQLStationContext(configuration.GetConnectionString("DefaultConnection"));
     stationRepo      = new StationRepository(stationContext);
     stationConverter = new StationViewModelConverter();
     trajectContext   = new MSSQLTrajectContext(configuration.GetConnectionString("DefaultConnection"));
     trajectRepo      = new TrajectRepository(trajectContext);
     trajectConverter = new TrajectViewModelConverter();
 }