26 lines
642 B
C#
26 lines
642 B
C#
using System.Net.Http;
|
|
using System.Net.Http.Json;
|
|
using WinForms.Models;
|
|
|
|
namespace WinForms
|
|
{
|
|
public partial class EmployeeDirectory : Form
|
|
{
|
|
public EmployeeDirectory()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void label1_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private async void EmployeeDirectory_Load(object sender, EventArgs e)
|
|
{
|
|
using var client = new HttpClient();
|
|
var results = await client.GetFromJsonAsync<List<EmployeeModel>>("https://localhost:7126/employees");
|
|
employeeList.DataSource = results;
|
|
}
|
|
}
|
|
} |