WORK-EF_WebAPI
David D'ALMEIDA 1 year ago
parent 13518b1dbd
commit e66064a15e

@ -35,8 +35,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestApi", "Tests\TestsA
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestsEntities", "Tests\UnitTestsEntities\UnitTestsEntities.csproj", "{31FA8E5E-D642-4C43-A2B2-02B9832B2CEC}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestsEntities", "Tests\UnitTestsEntities\UnitTestsEntities.csproj", "{31FA8E5E-D642-4C43-A2B2-02B9832B2CEC}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedEF", "SharedEF\SharedEF.csproj", "{55478079-0AA0-47C1-97FF-A048091FD930}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Model2Entities", "Model2Entities\Model2Entities.csproj", "{FA329DEF-4756-4A8B-84E9-5A625FF94CBF}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Model2Entities", "Model2Entities\Model2Entities.csproj", "{FA329DEF-4756-4A8B-84E9-5A625FF94CBF}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StubAPI", "StubAPI\StubAPI.csproj", "{C9BD0310-DC18-4356-B8A7-2B6959AF7813}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StubAPI", "StubAPI\StubAPI.csproj", "{C9BD0310-DC18-4356-B8A7-2B6959AF7813}"
@ -110,10 +108,6 @@ Global
{31FA8E5E-D642-4C43-A2B2-02B9832B2CEC}.Debug|Any CPU.Build.0 = Debug|Any CPU {31FA8E5E-D642-4C43-A2B2-02B9832B2CEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{31FA8E5E-D642-4C43-A2B2-02B9832B2CEC}.Release|Any CPU.ActiveCfg = Release|Any CPU {31FA8E5E-D642-4C43-A2B2-02B9832B2CEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{31FA8E5E-D642-4C43-A2B2-02B9832B2CEC}.Release|Any CPU.Build.0 = Release|Any CPU {31FA8E5E-D642-4C43-A2B2-02B9832B2CEC}.Release|Any CPU.Build.0 = Release|Any CPU
{55478079-0AA0-47C1-97FF-A048091FD930}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{55478079-0AA0-47C1-97FF-A048091FD930}.Debug|Any CPU.Build.0 = Debug|Any CPU
{55478079-0AA0-47C1-97FF-A048091FD930}.Release|Any CPU.ActiveCfg = Release|Any CPU
{55478079-0AA0-47C1-97FF-A048091FD930}.Release|Any CPU.Build.0 = Release|Any CPU
{FA329DEF-4756-4A8B-84E9-5A625FF94CBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FA329DEF-4756-4A8B-84E9-5A625FF94CBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA329DEF-4756-4A8B-84E9-5A625FF94CBF}.Debug|Any CPU.Build.0 = Debug|Any CPU {FA329DEF-4756-4A8B-84E9-5A625FF94CBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA329DEF-4756-4A8B-84E9-5A625FF94CBF}.Release|Any CPU.ActiveCfg = Release|Any CPU {FA329DEF-4756-4A8B-84E9-5A625FF94CBF}.Release|Any CPU.ActiveCfg = Release|Any CPU

@ -19,7 +19,7 @@ public class UsersController : Controller
public UsersController(ILogger<UsersController> logger, IDataManager dataManager) public UsersController(ILogger<UsersController> logger, IDataManager dataManager)
{ {
_logger = logger; _logger = logger;
_userService = dataManager.UserRepository; _userService = dataManager.UserRepo;
} }
[HttpGet] [HttpGet]

@ -4,6 +4,6 @@ namespace Model.Manager;
public interface IDataManager public interface IDataManager
{ {
IUserRepository UserRepository { get; } IUserRepository UserRepo { get; }
IActivityRepository ActivityRepository { get; } IActivityRepository ActivityRepo { get; }
} }

@ -1,4 +1,6 @@
using SharedEF; using Model;
using Model.Repository;
using Shared;
namespace Model2Entities; namespace Model2Entities;
@ -13,42 +15,28 @@ public partial class DbDataManager
_dataManager = dataManager; _dataManager = dataManager;
} }
public async Task<IEnumerable<Activity>> GetItems(int index, int count, Enum? orderingProperty = null, bool descending = false)
{ public async Task<IEnumerable<Activity>> GetActivities(int index, int count, ActivityOrderCriteria criteria, bool descending = false)
// public class MyLogger {
// {
// public void Log(string component, string message)
// {
// Console.WriteLine("Component: {0} Message: {1} ", component, message);
// }
// }
// ? Utilisation du logger !!!
//! using (var context = new LibraryContext())
//! {
// var logger = new MyLogger();
// context.Database.Log = s => logger.Log("EFApp", s);
//! // log la connexion à la base de donnée
//! context.Database.Log = Console.Write;
//! }
throw new NotImplementedException(); throw new NotImplementedException();
} }
public async Task<Activity> GetItemById(int id) public async Task<Activity?> GetActivityByIdAsync(int id)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public async Task<Activity> UpdateItem(int oldItem, Activity newItem) public async Task<Activity?> AddActivity(Activity activity)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public async Task<Activity> AddItem(Activity item) public async Task<Activity?> UpdateActivity(int id, Activity activity)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public async Task<bool> DeleteItem(Activity item) public async Task<bool> DeleteActivity(int id)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

@ -1,5 +1,6 @@
using DbContextLib; using DbContextLib;
using SharedEF; using Model.Manager;
using Model.Repository;
namespace Model2Entities; namespace Model2Entities;
@ -24,5 +25,4 @@ public DbDataManager(HeartTrackContext dbContext)
ActivityRepo = new ActivityRepository(this); ActivityRepo = new ActivityRepository(this);
UserRepo= new UserRepository(this); UserRepo= new UserRepository(this);
} }
} }

@ -8,7 +8,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DbContextLib\DbContextLib.csproj" /> <ProjectReference Include="..\DbContextLib\DbContextLib.csproj" />
<ProjectReference Include="..\SharedEF\SharedEF.csproj" /> <ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -1,4 +1,6 @@
using SharedEF; using Model;
using Model.Repository;
using Shared;
namespace Model2Entities; namespace Model2Entities;
@ -13,5 +15,39 @@ public partial class DbDataManager
_dataManager = dataManager; _dataManager = dataManager;
} }
public async Task<IEnumerable<User>> GetItems(int index, int count, string? orderingProperty = null, bool descending = false)
{
throw new NotImplementedException();
}
public async Task<User?> GetItemById(int id)
{
throw new NotImplementedException();
}
public async Task<User?> UpdateItem(int oldItem, User newItem)
{
throw new NotImplementedException();
}
public async Task<User?> AddItem(User item)
{
throw new NotImplementedException();
}
public async Task<bool> DeleteItem(int item)
{
throw new NotImplementedException();
}
public async Task<int> GetNbItems()
{
throw new NotImplementedException();
}
public async Task<IEnumerable<User>> GetUsers(int index, int count, AthleteOrderCriteria? criteria, bool descending = false)
{
throw new NotImplementedException();
}
} }
} }

@ -5,12 +5,12 @@ namespace StubAPI;
public class StubData : IDataManager public class StubData : IDataManager
{ {
public IUserRepository UserRepository { get; } public IUserRepository UserRepo { get; }
public IActivityRepository ActivityRepository { get; } public IActivityRepository ActivityRepo { get; }
public StubData() public StubData()
{ {
UserRepository = new UserService(); UserRepo = new UserService();
ActivityRepository = new ActivityService(); ActivityRepo = new ActivityService();
} }
} }
Loading…
Cancel
Save