public IActionResult MovieDetail(int id) { // show movie detail Customer cus = null; if (!Auth.isAuth(HttpContext, ref cus)) { return(Unauthorized()); } ViewBag.customer = cus; using (var context = new MovifyContext()) { var movie = context.Movies. Include(x => x.genre). Include(x => x.MovieShows). ThenInclude(x => x.theater). FirstOrDefault(x => x.id == id); if (movie == null) { return(NotFound()); } ViewBag.movie = movie; return(View()); } }
public static bool isAdmin(HttpContext httpContext, ref Customer cus) { if (debugMode) { using (var mc = new MovifyContext()) { cus = mc.Customers.Find("*****@*****.**"); return(true); } } if (httpContext == null) { return(false); } var session = httpContext.Session; if (session == null) { return(false); } var cusJSON = session.Get("customer"); if (cusJSON == null) { return(false); } cus = JsonSerializer.Deserialize <Customer>(cusJSON); return(cus.role == "admin"); }
public GenresController() { _context = new MovifyContext(); unitOfWork = new UnitOfWork(_context); }
public GenreRepository(MovifyContext context) : base(context) { }
public UnitOfWork(MovifyContext context) { this.context = context; }
public MoviesController() { _context = new MovifyContext(); }
public TheatersController() { _context = new MovifyContext(); }
public CustomerController() { context = new MovifyContext(); }
public FeedController() { context = new MovifyContext(); }