Beispiel #1
0
 public async Task<HttpResponseMessage> PutUser(UserDto userDto)
 {
     var user = new User();
     user.InjectFrom(userDto);
     await _operations.Update(user);
     return Request.CreateResponse(HttpStatusCode.NoContent);
 }
Beispiel #2
0
        public async Task<UserDto> PostUser(UserDto user)
        {
            if (string.IsNullOrEmpty(user.Id))
            {
                throw new HttpException(400, "User id should be supplied");
            }
            
            var newUser = new User();
            newUser.Active = true;
            newUser.InjectFrom(user);

            await _operations.Create(newUser);
            var result = new UserDto();
            result.InjectFrom(newUser);
            return result;
        }