/// <summary> /// Used to check if there is a logged in user and if he is a manager /// </summary> public static void CheckIfLoginAndManager(Controller controller, FlyMeContext context) { int?currentUserId = controller.HttpContext.Session.GetInt32("UserId"); if (currentUserId != null) { var currentUser = context.User.FirstOrDefault(u => u.ID == currentUserId); if (currentUser != null) { controller.ViewBag.IsLogin = true; controller.ViewBag.IsManager = currentUser.IsManager; controller.ViewBag.LoginUserDisplayName = $"{currentUser.FirstName} {currentUser.LastName}"; } } }
public AirportsController(FlyMeContext context) { _context = context; }
public HomeController(FlyMeContext context) { _context = context; }
public UsersController(FlyMeContext context) { _context = context; }
public TicketsController(FlyMeContext context) { _context = context; }
public StatisticsController(FlyMeContext context) { _context = context; }
public AirplanesController(FlyMeContext context) { _context = context; }
public FlightsController(FlyMeContext context) { _context = context; }