예제 #1
0
        public async Task <TEntity> Add(TEntity entity)
        {
            context.Set <TEntity>().Add(entity);
            await context.SaveChangesAsync();

            return(entity);
        }
예제 #2
0
        public async Task <User> Register(User user, string password)
        {
            byte[] passHash, passSalt;
            CreatePasswordHash(password, out passHash, out passSalt);

            user.PasswordHash = passHash;
            user.PasswordSalt = passSalt;

            await _context.User.AddAsync(user);

            await _context.SaveChangesAsync();

            return(user);
        }