Example #1
0
 //
 // GET: /Admin/
 public ActionResult Index()
 {
     DynamicDb db = new DynamicDb();
     //ViewBag.AllContent = db.RunQuery<Content>(DynamicDb.Db.Select, "Content", new string[]{}, cols: new string[]{"*"});
     ViewBag.AllLogs = db.RunQuery<Log>(DynamicDb.Db.Select, "Logger", new string[] { }, cols: new string[] { "*" });
     ViewBag.AllUsers = new List<User>() {
         new User() { Type = "Admin", UserId = 1, Username = "Totzp00" },
         new User() { Type = "Teacher", UserId = 2, Username = "Duerrr34" },
         new User(){Type="Student", UserId = 3, Username = "Muicha11"}
     };
     return View();
 }
Example #2
0
 public bool IsValid(string username, string password, DynamicDb db)
 {
     byte[] bytes = Encoding.UTF8.GetBytes(password);
     SHA256Managed hashstring = new SHA256Managed();
     byte[] hash = hashstring.ComputeHash(bytes);
     string hashString = string.Empty;
     foreach (byte x in hash)
     {
         hashString += String.Format("{0:x2}", x);
     }
     try
     {
         return db.RunListProcedure<Composites.User>("[LoginUser]", new { username = username, password = hashString }).Any();
     }
     catch (Exception)
     {
         return false;
         throw;
     }
 }
Example #3
0
        public bool IsValid(string username, string password, string email, DynamicDb db)
        {
            byte[] bytes = Encoding.UTF8.GetBytes(password);
            SHA256Managed hashstring = new SHA256Managed();
            byte[] hash = hashstring.ComputeHash(bytes);
            string hashString = string.Empty;
            foreach (byte x in hash)
            {
                hashString += String.Format("{0:x2}", x);
            }
            try
            {
                var user = db.RunProcedure<Composites.User>("InsertUser", new { username = username, password = hashString, email = email, userdata = "" });

                return user != null;
            }
            catch (Exception ex)
            {
                return false;
            }
        }
Example #4
0
 public HomeController()
 {
     this.db = new DynamicDb();
     this.logger = new Logger();
 }
Example #5
0
 public SummonerDb()
 {
     db = new DynamicDb();
 }
Example #6
0
 public Logger(DynamicDb db =null)
 {
     this.db = db ?? new DynamicDb();
 }
Example #7
0
 public UserController()
 {
     this._logger = new Logger();
     this._dynamicDb = new DynamicDb();
 }
Example #8
0
 public AdminService()
 {
     this.db = new DynamicDb();
     this.logger = new Logger(db);
 }