示例#1
0
 public bool UserExists(string email, string password)
 {
     using (var db = new JudgeDbContext())
     {
         return(db.Users.Any(u => u.Email == email && u.Password == password));
     }
 }
示例#2
0
 static Launcher()
 {
     using (var db = new JudgeDbContext())
     {
         db.Database.Migrate();
     }
 }
        static Launcher()
        {
            using (var context = new JudgeDbContext())
            {
                context.Database.Migrate();
            }

            AutoMapperConfiguration.Initialize();
        }
示例#4
0
        private static void Main()
        {
            using (var db = new JudgeDbContext())
            {
                db.Database.Migrate();
            }

            AutoMapperConfiguration.Initialize();

            MvcEngine.Run(
                new WebServer.WebServer(1337,
                                        DependencyControllerRouter.Get(),
                                        new ResourceRouter()));
        }
示例#5
0
        protected override void InitializeController()
        {
            base.InitializeController();

            if (this.User.IsAuthenticated)
            {
                this.ViewModel["anonymousDisplay"] = "none";
                this.ViewModel["userDisplay"]      = "flex";

                using (var db = new JudgeDbContext())
                {
                    this.Profile = db
                                   .Users
                                   .First(u => u.Email == this.User.Name);
                }
            }
        }
示例#6
0
        public bool Create(string email, string password, string name)
        {
            using (var db = new JudgeDbContext())
            {
                if (db.Users.Any(u => u.Email == email))
                {
                    return(false);
                }

                var isAdmin = !db.Users.Any();

                var user = new User
                {
                    Email    = email,
                    Password = password,
                    IsAdmin  = isAdmin,
                    FullName = name
                };
                db.Add(user);
                db.SaveChanges();

                return(true);
            }
        }
示例#7
0
 public UserService(JudgeDbContext db)
 {
     this.db = db;
 }
示例#8
0
 public UserService()
 {
     this.db = new JudgeDbContext();
 }
 public SubmissionService()
 {
     this.db = new JudgeDbContext();
 }
示例#10
0
 public LoginModel GetById(int id)
 {
     using (var db = new JudgeDbContext())
     {
     }
 }
示例#11
0
 public SubmissionService(JudgeDbContext context)
 {
     this.context = context;
 }
示例#12
0
 protected BaseController()
 {
     this.DbContext   = new JudgeDbContext();
     this.hashService = new HashService(new ConsoleLogger());
 }
 public UserService(JudgeDbContext context)
 {
     this.context = context;
 }
示例#14
0
 public ContestService()
 {
     this.db = new JudgeDbContext();
 }
 public ContestService(JudgeDbContext context)
 {
     this.context = context;
 }