Ejemplo n.º 1
0
        public async Task <ActionResult <User> > Create(User user)
        {
            try
            {
                var createdUser = await remoteService.CreateAsync(user);

                return(CreatedAtAction(nameof(Get), new { id = createdUser.Id }, createdUser));
            }
            catch (ApiException ex)
            {
                switch (ex.StatusCode)
                {
                case 400:
                    return(BadRequest());
                }
            }
            return(StatusCode(StatusCodes.Status500InternalServerError));
        }