//
 // 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();
 }
Exemple #2
0
        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" });
        }
Exemple #3
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;
     }
 }
        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;
            }
        }
Exemple #5
0
 public HomeController()
 {
     this.db = new DynamicDb();
     this.logger = new Logger();
 }
 public SummonerDb()
 {
     db = new DynamicDb();
 }
Exemple #7
0
 public Logger(DynamicDb db =null)
 {
     this.db = db ?? new DynamicDb();
 }
Exemple #8
0
 public UserController()
 {
     this._logger = new Logger();
     this._dynamicDb = new DynamicDb();
 }
 public AdminService()
 {
     this.db = new DynamicDb();
     this.logger = new Logger(db);
 }