Exemple #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));
     }
 }
Exemple #2
0
 static Launcher()
 {
     using (var db = new JudgeDbContext())
     {
         db.Database.Migrate();
     }
 }
        static Launcher()
        {
            using (var context = new JudgeDbContext())
            {
                context.Database.Migrate();
            }

            AutoMapperConfiguration.Initialize();
        }
Exemple #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()));
        }
Exemple #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);
                }
            }
        }
Exemple #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);
            }
        }
Exemple #7
0
 public UserService(JudgeDbContext db)
 {
     this.db = db;
 }
Exemple #8
0
 public UserService()
 {
     this.db = new JudgeDbContext();
 }
 public SubmissionService()
 {
     this.db = new JudgeDbContext();
 }
Exemple #10
0
 public LoginModel GetById(int id)
 {
     using (var db = new JudgeDbContext())
     {
     }
 }
Exemple #11
0
 public SubmissionService(JudgeDbContext context)
 {
     this.context = context;
 }
Exemple #12
0
 protected BaseController()
 {
     this.DbContext   = new JudgeDbContext();
     this.hashService = new HashService(new ConsoleLogger());
 }
 public UserService(JudgeDbContext context)
 {
     this.context = context;
 }
 public ContestService()
 {
     this.db = new JudgeDbContext();
 }
 public ContestService(JudgeDbContext context)
 {
     this.context = context;
 }