Exemplo n.º 1
0
        public static void SeedDB(StairsAppContext ctx)
        {
            string password = "******";

            byte[] passwordHash, passwordSalt;
            CreatePasswordHash(password, out passwordHash, out passwordSalt);


            User userMichal = new User
            {
                Username     = "******",
                PasswordHash = passwordHash,
                PasswordSalt = passwordSalt,
                IsAdmin      = true
            };

            ctx.Users.Add(userMichal);
            ctx.SaveChanges();
        }
Exemplo n.º 2
0
 public void Add(User entity)
 {
     _ctx.Users.Add(entity);
     _ctx.SaveChanges();
 }
Exemplo n.º 3
0
 public Product Create(Product newProduct)
 {
     _stairsAppContext.Attach(newProduct).State = EntityState.Added;
     _stairsAppContext.SaveChanges();
     return(newProduct);
 }