Skip to content
Snippets Groups Projects
Commit 314f16e1 authored by Nahodil, Petr's avatar Nahodil, Petr
Browse files

Merge remote-tracking branch 'origin/master'

parents c5f466fe f6276748
No related branches found
No related tags found
No related merge requests found
......@@ -25,8 +25,8 @@
services.AddScoped<PersonFacade, PersonFacade>();
services.AddScoped<FlightFacade, FlightFacade>();
services.AddScoped<IClubUserDatabase, ClubUserDatabaseStub>();
// services.AddScoped<IClubUserDatabase, ClubUserDatabase>();
// services.AddScoped<IClubUserDatabase, ClubUserDatabaseStub>();
services.AddScoped<IClubUserDatabase, ClubUserDatabase>();
}
}
}
namespace FlightLogNet.Integration
using System;
using RestSharp;
namespace FlightLogNet.Integration
{
using System.Collections.Generic;
using System.Linq;
......@@ -29,13 +32,27 @@
private List<ClubUser> ReceiveClubUsers()
{
// TODO 8.2: Naimplementujte volání endpointu ClubDB pomocí RestSharp
return null;
string baseUrl = configuration["ClubUsersApi"]; // Retrieve the base URL from configuration
// Check if baseUrl is null or empty before using it
if (string.IsNullOrWhiteSpace(baseUrl))
{
throw new InvalidOperationException("Base URL for 'ClubUsersApi' is not configured or is empty.");
}
var client = new RestClient(baseUrl);
var request = new RestRequest("club/user");
var response = client.Get<List<ClubUser>>(request);
return response;
}
private List<PersonModel> TransformToPersonModel(IList<ClubUser> users)
{
return null;
return users.Select(user => new PersonModel
{
MemberId = user.MemberId,
FirstName = user.FirstName,
LastName = user.LastName,
}).ToList();
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment