public async Task <UserModel> Post([FromBody] CreateUserModel requestModel) { var item = await _query.Create(requestModel); var model = _mapper.Map <UserModel>(item); return(model); }
public async Task CreateShouldSaveNewUser() { var model = new CreateUserModel { Password = _random.Next().ToString(), Username = _random.Next().ToString(), LastName = _random.Next().ToString(), FirstName = _random.Next().ToString(), }; var result = await _query.Create(model); result.Password.Should().NotBeEmpty(); result.UserName.Should().Be(model.Username); result.LastName.Should().Be(model.LastName); result.FirstName.Should().Be(model.FirstName); _uow.Verify(x => x.Add(result)); _uow.Verify(x => x.CommitAsync()); }
public async Task <User> Register(RegisterModel model) { var requestModel = new CreateUserModel { FirstName = model.FirstName, LastName = model.LastName, Password = model.Password, Username = model.Username }; var user = await _usersQuery.Create(requestModel); return(user); }