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(); }
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()); }
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(); }