예제 #1
0
        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());
            }
        }
예제 #2
0
        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");
        }
예제 #3
0
 public GenresController()
 {
     _context   = new MovifyContext();
     unitOfWork = new UnitOfWork(_context);
 }
예제 #4
0
 public GenreRepository(MovifyContext context) : base(context)
 {
 }
예제 #5
0
 public UnitOfWork(MovifyContext context)
 {
     this.context = context;
 }
예제 #6
0
 public MoviesController()
 {
     _context = new MovifyContext();
 }
예제 #7
0
 public TheatersController()
 {
     _context = new MovifyContext();
 }
예제 #8
0
 public CustomerController()
 {
     context = new MovifyContext();
 }
예제 #9
0
 public FeedController()
 {
     context = new MovifyContext();
 }