Initial API setup and basic program functioning
This commit is contained in:
@@ -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.
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user