Crud on users
All checks were successful
Game Ideas build for PR / build_blazor_app (pull_request) Successful in 52s

This commit is contained in:
2025-04-27 19:56:17 +02:00
parent 63622bd299
commit 757e9db08d
17 changed files with 182 additions and 44 deletions

View File

@@ -9,11 +9,11 @@ namespace GameIdeas.BlazorApp.Pages.Users.Gateways;
public class UserGateway(IHttpClientService httpClient) : IUserGateway
{
public async Task<string> CreateUser(UserDto user)
public async Task<IdDto> CreateUser(UserDto user)
{
try
{
return await httpClient.PostAsync<string>(Endpoints.User.Create, user)
return await httpClient.PostAsync<IdDto>(Endpoints.User.Create, user)
?? throw new InvalidOperationException(ResourcesKey.ErrorCreateUser);
}
catch (Exception)
@@ -22,11 +22,11 @@ public class UserGateway(IHttpClientService httpClient) : IUserGateway
}
}
public async Task<string> DeleteUser(string userId)
public async Task<IdDto> DeleteUser(string userId)
{
try
{
return await httpClient.DeleteAsync<string>(Endpoints.User.Delete(userId))
return await httpClient.DeleteAsync<IdDto>(Endpoints.User.Delete(userId))
?? throw new InvalidOperationException(ResourcesKey.ErrorDeleteUser);
}
catch (Exception)
@@ -69,11 +69,11 @@ public class UserGateway(IHttpClientService httpClient) : IUserGateway
}
}
public async Task<string> UpdateUser(UserDto user)
public async Task<IdDto> UpdateUser(UserDto user)
{
try
{
return await httpClient.PutAsync<string>(Endpoints.User.Update(user.Id ?? string.Empty), user)
return await httpClient.PutAsync<IdDto>(Endpoints.User.Update(user.Id ?? string.Empty), user)
?? throw new InvalidOperationException(ResourcesKey.ErrorUpdateUser);
}
catch (Exception)