// // 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 = "******" }, new User() { Type = "Teacher", UserId = 2, Username = "******" }, new User(){Type="Student", UserId = 3, Username = "******"} }; return View(); }
public void SampleEntries() { dynamic db = new DynamicDb(); var blogId = db.Blogs().Insert(new { Title = "Title 1" }); db.Comments().Insert(new { blogId, Text = "comment 1" }); db.Comments().Insert(new { blogId, Text = "comment 2" }); blogId = db.Blogs().Insert(new { Title = "Title 2" }); db.Comments().Insert(new { blogId, Text = "comment 3" }); db.Comments().Insert(new { blogId, Text = "comment 4" }); }
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; } }
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; } }
public HomeController() { this.db = new DynamicDb(); this.logger = new Logger(); }
public SummonerDb() { db = new DynamicDb(); }
public Logger(DynamicDb db =null) { this.db = db ?? new DynamicDb(); }
public UserController() { this._logger = new Logger(); this._dynamicDb = new DynamicDb(); }
public AdminService() { this.db = new DynamicDb(); this.logger = new Logger(db); }