コード例 #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
ファイル: UnitOfWork.cs プロジェクト: congthanh112/C-Project
 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();
 }