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(); }
public void Add(User entity) { _ctx.Users.Add(entity); _ctx.SaveChanges(); }
public Product Create(Product newProduct) { _stairsAppContext.Attach(newProduct).State = EntityState.Added; _stairsAppContext.SaveChanges(); return(newProduct); }