예제 #1
0
 private static UserResponse ToResponse(UserDocument user)
 {
     return
         (new UserResponse
     {
         Id = user.Id,
         Name = user.Name,
         Version = Environment.GetEnvironmentVariable("APP_VERSION"),
         Host = Environment.MachineName
     });
 }
예제 #2
0
        public async Task <UserResponse> Post([FromBody] CreateUserRequest request)
        {
            var user = new UserDocument
            {
                Id   = Guid.NewGuid().ToString("N"),
                Name = request.Name
            };

            await this.users.InsertOneAsync(user);

            return(ToResponse(user));
        }