**Note: This implementation is not in minimalAPI way and not optimized, expected to be changed soon.** Add: `UserService` and its interface `IUserService`. Fix: `UserEndpoint` is now in instance class style with DI to work. Fix: change main program to work with above design.
25 lines
537 B
C#
25 lines
537 B
C#
using OptixServe.Core.Models;
|
|
|
|
namespace OptixServe.Core.Services;
|
|
|
|
public interface IUserService
|
|
{
|
|
IEnumerable<User> GetUsers();
|
|
User? GetUserById(string Id);
|
|
}
|
|
|
|
public class UserService : IUserService
|
|
{
|
|
public User? GetUserById(string Id)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public IEnumerable<User> GetUsers()
|
|
{
|
|
return [
|
|
new() { Id = "1234", UserName = "xxx", Password = "pass1" },
|
|
new() { Id = "5678", UserName = "yyy", Password = "pass2" }
|
|
];
|
|
}
|
|
} |