Initial API setup and basic program functioning

This commit is contained in:
2026-03-24 12:29:07 +10:30
parent e5fcaad365
commit f26ff6e04a
17 changed files with 279 additions and 0 deletions
@@ -0,0 +1,26 @@
using Emergence.models;
using Emergence.services.Interface;
namespace Emergence.services.Services;
public class UserService : IUserService
{
private List<UserModel> testList = [
new UserModel {Id = 1, Username = "chris", Email ="chris@fjp.com.au" },
new UserModel {Id = 2, Username = "kim", Email ="kim@fjp.com.au" },
new UserModel {Id = 3, Username = "amanda", Email ="amanda@fjp.com.au" },
new UserModel {Id = 4, Username = "reception", Email ="reception@fjp.com.au" },
];
public async Task<IList<UserModel>> GetAllAsync()
{
return testList;
}
public async Task<UserModel> GetByIdAsync(int id)
{
#pragma warning disable CS8603 // Possible null reference return.
return testList.FirstOrDefault(f => f.Id == id);
#pragma warning restore CS8603 // Possible null reference return.
}
}