[EndpointName(nameof(UpdateUser))]
[EndpointSummary("Update an existing user")]
[EndpointDescription("Updates the details of an existing user. The user ID in the URL")]
public async Task<
Results<
Ok<UserDto>,
NotFound,
BadRequest
>> UpdateUser(ISender sender, int id, UpdateUserCommand command)
{
if (id != command.Id)
{
return TypedResults.BadRequest();
}
var user = await sender.Send(command);
return TypedResults.Ok(user);
}
[EndpointName(nameof(UpdateUser))]
[EndpointSummary("Update an existing user")]
[EndpointDescription("Updates the details of an existing user. The user ID in the URL")]
public async Task<
Results<
Ok<UserDto>,
NotFound,
BadRequest
>> UpdateUser(ISender sender, int id, UpdateUserCommand command)
{
if (id != command.Id)
{
return TypedResults.BadRequest();
}
var user = await sender.Send(command);
return TypedResults.Ok(user);
}