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
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestsEntities", "Tests\UnitTestsEntities\UnitTestsEntities.csproj", "{31FA8E5E-D642-4C43-A2B2-02B9832B2CEC}"
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}"
EndProject
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}.Release|Any CPU.ActiveCfg = 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.Build.0 = Debug|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)
{
_logger = logger;
_userService = dataManager.UserRepository;
_userService = dataManager.UserRepo;
}
[HttpGet]

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

@ -1,4 +1,6 @@
using SharedEF;
using Model;
using Model.Repository;
using Shared;
namespace Model2Entities;
@ -13,42 +15,28 @@ public partial class DbDataManager
_dataManager = dataManager;
}
public async Task<IEnumerable<Activity>> GetItems(int index, int count, Enum? orderingProperty = null, 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;
//! }
public async Task<IEnumerable<Activity>> GetActivities(int index, int count, ActivityOrderCriteria criteria, bool descending = false)
{
throw new NotImplementedException();
}
public async Task<Activity> GetItemById(int id)
public async Task<Activity?> GetActivityByIdAsync(int id)
{
throw new NotImplementedException();
}
public async Task<Activity> UpdateItem(int oldItem, Activity newItem)
public async Task<Activity?> AddActivity(Activity activity)
{
throw new NotImplementedException();
}
public async Task<Activity> AddItem(Activity item)
public async Task<Activity?> UpdateActivity(int id, Activity activity)
{
throw new NotImplementedException();
}
public async Task<bool> DeleteItem(Activity item)
public async Task<bool> DeleteActivity(int id)
{
throw new NotImplementedException();
}

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

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

@ -1,4 +1,6 @@
using SharedEF;
using Model;
using Model.Repository;
using Shared;
namespace Model2Entities;
@ -13,5 +15,39 @@ public partial class DbDataManager
_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 IUserRepository UserRepository { get; }
public IActivityRepository ActivityRepository { get; }
public IUserRepository UserRepo { get; }
public IActivityRepository ActivityRepo { get; }
public StubData()
{
UserRepository = new UserService();
ActivityRepository = new ActivityService();
UserRepo = new UserService();
ActivityRepo = new ActivityService();
}
}
Loading…
Cancel
Save