Esempio n. 1
0
 public void AddFile(Image image)
 {
     using (var dc = new CheckingContext(_connectionString))
     {
         dc.Images.Add(image);
         dc.SaveChanges();
     }
 }
Esempio n. 2
0
 public Order UpdateOrder(Order order, Questionnaire q)
 {
     using (CheckingContext db = new CheckingContext(_connectionString))
     {
         Order o = db.Orders.Find(order.OrderID);
         o.Questionnaire = q;
         db.SaveChanges();
     }
     return(order);
 }
Esempio n. 3
0
        public int CreateOrder(Order o)
        {
            using (CheckingContext db = new CheckingContext(_connectionString))
            {
                db.Orders.Add(o);
                db.SaveChanges();
            }

            return(o.OrderID);
        }
Esempio n. 4
0
        public void AddUser(string username, string password)
        {
            User   user         = new User();
            string salt         = PasswordHelper.GenerateRandomSalt();
            string passwordHash = PasswordHelper.HashPassword(password, salt);

            user.PasswordHash = passwordHash;
            user.Salt         = salt;
            user.UserName     = username;
            user.Role         = Role.Admin;
            using (var dc = new CheckingContext(_connectionString))
            {
                dc.Users.Add(user);
                dc.SaveChanges();
            }
        }