Пример #1
0
        public user register(user u, string pass)
        {
            byte[] hash, salt;

            creathash(pass, out hash, out salt);

            u.hash = hash;
            u.salt = salt;
            _context.users.AddAsync(u);
            _context.SaveChanges();
            return(u);
        }
 public static void CreateSeedData(this StoreAppContext context)
 {
     if (context.Database.GetMigrations().Count() > 0 &&
         context.Database.GetPendingMigrations().Count() == 0 &&
         context.values.Count() == 0)
     {
         var v1 = new value {
             name = "value1",
         };
         var v2 = new value {
             name = "value2",
         };
         context.values.AddRange(v1, v2);
         context.SaveChanges();
     }
 }