Пример #1
0
        public async Task <UserDto> CreateAsync(UserDto user)
        {
            var utcNow = DateTime.UtcNow;
            var entity = _mapper.Map <User>(user);

            entity.Created  = utcNow;
            entity.Modified = utcNow;

            await _context.User.AddAsync(entity);

            await _context.SaveChangesAsync(true);

            var userDb = await GetUserAsync(user.Username);

            return(_mapper.Map <UserDto>(userDb));
        }
Пример #2
0
        public async Task CreatePasswordAsync(int userId, byte[] passwordHashBytes)
        {
            await _context.Password.AddAsync(new Password()
            {
                PasswordHash = passwordHashBytes,
                Userid       = userId
            });

            await _context.SaveChangesAsync(true);
        }