diff --git a/API_SQLuedo/API/API.csproj b/API_SQLuedo/API/API.csproj
index 7d09073..e9ccb98 100644
--- a/API_SQLuedo/API/API.csproj
+++ b/API_SQLuedo/API/API.csproj
@@ -27,8 +27,9 @@
-
+
+
diff --git a/API_SQLuedo/API/Controllers/UserController.cs b/API_SQLuedo/API/Controllers/UserController.cs
index 612d0ff..9596304 100644
--- a/API_SQLuedo/API/Controllers/UserController.cs
+++ b/API_SQLuedo/API/Controllers/UserController.cs
@@ -1,8 +1,6 @@
-using API.Service;
-using Dto;
+using Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-using ModelToEntities.Service;
using Shared;
namespace API.Controllers
diff --git a/API_SQLuedo/API/Program.cs b/API_SQLuedo/API/Program.cs
index 2f26e29..5f9663c 100644
--- a/API_SQLuedo/API/Program.cs
+++ b/API_SQLuedo/API/Program.cs
@@ -1,12 +1,13 @@
using API;
using API.Service;
using DbContextLib;
+using DbDataManager.Service;
using Dto;
+using Entities;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc.Versioning;
using Microsoft.EntityFrameworkCore;
using Microsoft.OpenApi.Models;
-using ModelToEntities.Service;
using Shared;
var builder = WebApplication.CreateBuilder(args);
@@ -17,9 +18,9 @@ builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
-builder.Services.AddScoped, UserDataService>();
+builder.Services.AddScoped, UserDataService>();
builder.Services.AddScoped, UserDataServiceApi>();
-builder.Services.AddScoped, InquiryDataService>();
+builder.Services.AddScoped, InquiryDataService>();
builder.Services.AddScoped, InquiryDataServiceApi>();
builder.Services.AddDbContext();
builder.Services.AddDbContext(options => options.UseInMemoryDatabase("appDb"));
diff --git a/API_SQLuedo/API/Service/InquiryDataServiceAPI.cs b/API_SQLuedo/API/Service/InquiryDataServiceAPI.cs
index 90eb3e7..68a2c1a 100644
--- a/API_SQLuedo/API/Service/InquiryDataServiceAPI.cs
+++ b/API_SQLuedo/API/Service/InquiryDataServiceAPI.cs
@@ -1,13 +1,19 @@
using Dto;
+using Entities;
using Shared;
+using Shared.Mapper;
namespace API.Service;
-public class InquiryDataServiceApi(IInquiryService inquiryService) : IInquiryService
+public class InquiryDataServiceApi(IInquiryService inquiryService) : IInquiryService
{
- public IEnumerable GetInquiries(int page, int number) => inquiryService.GetInquiries(page, number);
+ public IEnumerable GetInquiries(int page, int number)
+ {
+ var inquiries = inquiryService.GetInquiries(page, number);
+ return inquiries.Select(i => i.FromEntityToDTO()).ToList();
+ }
- public InquiryDTO GetInquiryById(int id) => inquiryService.GetInquiryById(id);
+ public InquiryDTO GetInquiryById(int id) => inquiryService.GetInquiryById(id).FromEntityToDTO();
- public InquiryDTO GetInquiryByTitle(string title) => inquiryService.GetInquiryByTitle(title);
+ public InquiryDTO GetInquiryByTitle(string title) => inquiryService.GetInquiryByTitle(title).FromEntityToDTO();
}
\ No newline at end of file
diff --git a/API_SQLuedo/API/Service/UserDataServiceAPI.cs b/API_SQLuedo/API/Service/UserDataServiceAPI.cs
index 66013dd..a4a6dca 100644
--- a/API_SQLuedo/API/Service/UserDataServiceAPI.cs
+++ b/API_SQLuedo/API/Service/UserDataServiceAPI.cs
@@ -1,20 +1,27 @@
using Dto;
+using Entities;
using Shared;
+using Shared.Mapper;
namespace API.Service;
-public class UserDataServiceApi(IUserService userService) : IUserService
+public class UserDataServiceApi(IUserService userService) : IUserService
{
- public IEnumerable GetUsers(int page, int number) => userService.GetUsers(page, number);
+ public IEnumerable GetUsers(int page, int number)
+ {
+ var usersEntities = userService.GetUsers(page, number);
+ return usersEntities.Select(e => e.FromEntityToDTO()).ToList();
+ }
- public UserDTO GetUserById(int id) => userService.GetUserById(id);
+ public UserDTO GetUserById(int id) => userService.GetUserById(id).FromEntityToDTO();
- public UserDTO GetUserByUsername(string username) => userService.GetUserByUsername(username);
+ public UserDTO GetUserByUsername(string username) => userService.GetUserByUsername(username).FromEntityToDTO();
public bool DeleteUser(int id) => userService.DeleteUser(id);
- public UserDTO UpdateUser(int id, UserDTO user) => userService.UpdateUser(id, user);
+ public UserDTO UpdateUser(int id, UserDTO user) =>
+ userService.UpdateUser(id, user.FromDTOToEntity()).FromEntityToDTO();
public UserDTO CreateUser(string username, string password, string email, bool isAdmin) =>
- userService.CreateUser(username, password, email, isAdmin);
+ userService.CreateUser(username, password, email, isAdmin).FromEntityToDTO();
}
\ No newline at end of file
diff --git a/API_SQLuedo/API_SQLuedo.sln b/API_SQLuedo/API_SQLuedo.sln
index c6c08b5..61850b6 100644
--- a/API_SQLuedo/API_SQLuedo.sln
+++ b/API_SQLuedo/API_SQLuedo.sln
@@ -7,7 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "API", "API\API.csproj", "{6
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Entities", "EntityFramework\Entities.csproj", "{6D079CDA-C000-4833-98A0-D07D153EA264}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ModelToEntities", "ModelToEntities\ModelToEntities.csproj", "{ADCC427D-A3CD-431C-A90B-F9369C4584E8}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DbDataManager", "DbDataManager\DbDataManager.csproj", "{ADCC427D-A3CD-431C-A90B-F9369C4584E8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestAPI", "TestAPI\TestAPI.csproj", "{17025B90-8B2A-49E9-97D3-1A84A208DF50}"
EndProject
diff --git a/API_SQLuedo/DbContextLib/UserDbContext.cs b/API_SQLuedo/DbContextLib/UserDbContext.cs
index a3956bb..8be1c6f 100644
--- a/API_SQLuedo/DbContextLib/UserDbContext.cs
+++ b/API_SQLuedo/DbContextLib/UserDbContext.cs
@@ -29,11 +29,11 @@ namespace DbContextLib
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
- modelBuilder.Entity().ToTable("user");
modelBuilder.Entity().HasKey(c => c.LessonId);
modelBuilder.Entity().HasKey(c => c.LessonPartId);
modelBuilder.Entity().HasKey(s => s.UserId);
modelBuilder.Entity().HasKey(s => s.InquiryId);
+ modelBuilder.Entity().HasKey(s => s.Id);
base.OnModelCreating(modelBuilder);
}
}
diff --git a/API_SQLuedo/Shared/Mapper/BlackListMapper.cs b/API_SQLuedo/Shared/Mapper/BlackListMapper.cs
new file mode 100644
index 0000000..945d823
--- /dev/null
+++ b/API_SQLuedo/Shared/Mapper/BlackListMapper.cs
@@ -0,0 +1,38 @@
+using Dto;
+using Entities;
+using ModelToEntities.Business;
+
+namespace Shared.Mapper;
+
+public static class BlackListMapper
+{
+ public static BlackListDTO FromModelToDTO(BlackList model)
+ {
+ return new BlackListDTO(model.Email, model.ExpirationDate);
+ }
+
+ public static BlackListDTO FromEntityToDTO(BlackListEntity ent)
+ {
+ return new BlackListDTO(ent.Email, ent.ExpirationDate);
+ }
+
+ public static BlackList FromDTOToModel(BlackListDTO dto)
+ {
+ return new BlackList(dto.Email, dto.ExpirationDate);
+ }
+
+ public static BlackList FromEntityToModel(BlackListEntity ent)
+ {
+ return new BlackList(ent.Email, ent.ExpirationDate);
+ }
+
+ public static BlackListEntity FromDTOToEntity(BlackListDTO dto)
+ {
+ return new BlackListEntity(dto.Email, dto.ExpirationDate);
+ }
+
+ public static BlackListEntity FromModelToEntity(BlackList model)
+ {
+ return new BlackListEntity(model.Email, model.ExpirationDate);
+ }
+}
\ No newline at end of file
diff --git a/API_SQLuedo/Shared/Mapper/ContentLessonMapper.cs b/API_SQLuedo/Shared/Mapper/ContentLessonMapper.cs
new file mode 100644
index 0000000..1feb9a1
--- /dev/null
+++ b/API_SQLuedo/Shared/Mapper/ContentLessonMapper.cs
@@ -0,0 +1,34 @@
+using Dto;
+using Entities;
+using ModelToEntities.Business;
+
+namespace Shared.Mapper;
+
+public static class ContentLessonMapper
+{
+ public static ContentLesson FromDTOToModel(this ContentLessonDTO dto)
+ {
+ return new ContentLesson(dto.LessonId, dto.LessonPartId);
+ }
+
+ public static ContentLesson FromEntityToModel(this ContentLessonEntity ent)
+ {
+ return new ContentLesson(ent.LessonId, ent.LessonPartId);
+ }
+
+ public static ContentLessonDTO FromModelToDTO(this ContentLesson les)
+ {
+ return new ContentLessonDTO(les.LessonId, les.LessonPartId);
+ }
+
+ public static ContentLessonDTO FromEntityToDTO(this ContentLessonEntity ent)
+ {
+ return new ContentLessonDTO(ent.LessonId, ent.LessonPartId);
+ }
+
+ public static ContentLessonEntity FromModelToEntity(this ContentLesson les)
+ {
+ return new ContentLessonEntity(les.LessonId, new LessonEntity(les.LessonId), les.LessonPartId,
+ new ParagraphEntity(les.LessonPartId));
+ }
+}
\ No newline at end of file
diff --git a/API_SQLuedo/Shared/Mapper/InquiryMapper.cs b/API_SQLuedo/Shared/Mapper/InquiryMapper.cs
new file mode 100644
index 0000000..7ade449
--- /dev/null
+++ b/API_SQLuedo/Shared/Mapper/InquiryMapper.cs
@@ -0,0 +1,44 @@
+using Dto;
+using Entities;
+using ModelToEntities.Business;
+
+namespace Shared.Mapper;
+
+public static class InquiryMapper
+{
+ public static Inquiry FromDTOToModel(this InquiryDTO InqDto)
+ {
+ return new Inquiry(InqDto.Id, InqDto.Title, InqDto.Description, InqDto.IsUser, InqDto.Database,
+ InqDto.InquiryTable);
+ }
+
+ public static Inquiry FromEntityToModel(this InquiryEntity InqEntity)
+ {
+ return new Inquiry(InqEntity.Id, InqEntity.Title, InqEntity.Description, InqEntity.IsUser,
+ InqEntity.Database.OwnerId, InqEntity.InquiryTable.OwnerId);
+ }
+
+
+ public static InquiryEntity FromModelToEntity(this Inquiry Inq)
+ {
+ return new InquiryEntity(Inq.Id, Inq.Title, Inq.Description, Inq.IsUser, new InquiryTableEntity(Inq.Database),
+ new SolutionEntity(Inq.InquiryTable));
+ }
+
+ public static InquiryEntity FromDTOToEntity(this InquiryDTO InqDto)
+ {
+ return new InquiryEntity(InqDto.Id, InqDto.Title, InqDto.Description, InqDto.IsUser,
+ new InquiryTableEntity(InqDto.Database), new SolutionEntity(InqDto.InquiryTable));
+ }
+
+ public static InquiryDTO FromModelToDTO(this Inquiry Inq)
+ {
+ return new InquiryDTO(Inq.Id, Inq.Title, Inq.Description, Inq.IsUser, Inq.Database, Inq.InquiryTable);
+ }
+
+ public static InquiryDTO FromEntityToDTO(this InquiryEntity InqEntity)
+ {
+ return new InquiryDTO(InqEntity.Id, InqEntity.Title, InqEntity.Description, InqEntity.IsUser,
+ InqEntity.Database.OwnerId, InqEntity.InquiryTable.OwnerId);
+ }
+}
\ No newline at end of file
diff --git a/API_SQLuedo/Shared/Mapper/InquiryTableMapper.cs b/API_SQLuedo/Shared/Mapper/InquiryTableMapper.cs
new file mode 100644
index 0000000..d5048a9
--- /dev/null
+++ b/API_SQLuedo/Shared/Mapper/InquiryTableMapper.cs
@@ -0,0 +1,38 @@
+using Dto;
+using Entities;
+using ModelToEntities.Business;
+
+namespace Shared.Mapper;
+
+public static class InquiryTableMapper
+{
+ public static InquiryTable FromDTOToModel(this InquiryTableDTO InqTDto)
+ {
+ return new InquiryTable(InqTDto.OwnerId, InqTDto.ConnectionInfo, InqTDto.DatabaseName);
+ }
+
+ public static InquiryTable FromEntityToModel(this InquiryTableEntity InqTEntity)
+ {
+ return new InquiryTable(InqTEntity.OwnerId, InqTEntity.ConnectionInfo, InqTEntity.DatabaseName);
+ }
+
+ public static InquiryTableDTO FromModelToDTO(this InquiryTable InqT)
+ {
+ return new InquiryTableDTO(InqT.OwnerId, InqT.DatabaseName, InqT.ConnectionInfo);
+ }
+
+ public static InquiryTableDTO FromEntityToDTO(this InquiryTableEntity InqTEntity)
+ {
+ return new InquiryTableDTO(InqTEntity.OwnerId, InqTEntity.DatabaseName, InqTEntity.ConnectionInfo);
+ }
+
+ public static InquiryTableEntity FromModelToEntity(this InquiryTable InqT)
+ {
+ return new InquiryTableEntity(InqT.OwnerId, InqT.DatabaseName, InqT.ConnectionInfo);
+ }
+
+ public static InquiryTableEntity FromDTOToEntity(this InquiryTableDTO dto)
+ {
+ return new InquiryTableEntity(dto.OwnerId, dto.DatabaseName, dto.ConnectionInfo);
+ }
+}
\ No newline at end of file
diff --git a/API_SQLuedo/Shared/Mapper/LessonMapper.cs b/API_SQLuedo/Shared/Mapper/LessonMapper.cs
new file mode 100644
index 0000000..9edf99f
--- /dev/null
+++ b/API_SQLuedo/Shared/Mapper/LessonMapper.cs
@@ -0,0 +1,38 @@
+using Dto;
+using Entities;
+using ModelToEntities.Business;
+
+namespace Shared.Mapper;
+
+public static class LessonMapper
+{
+ public static LessonDTO FromModelToDTO(Lesson model)
+ {
+ return new LessonDTO(model.Id, model.Title, model.LastPublisher, model.LastEdit);
+ }
+
+ public static LessonDTO FromEntityToDTO(LessonEntity model)
+ {
+ return new LessonDTO(model.Id, model.Title, model.LastPublisher, model.LastEdit);
+ }
+
+ public static LessonEntity FromModelToEntity(Lesson model)
+ {
+ return new LessonEntity(model.Id, model.Title, model.LastPublisher, model.LastEdit);
+ }
+
+ public static LessonEntity FromDTOToEntity(LessonDTO dto)
+ {
+ return new LessonEntity(dto.Id, dto.Title, dto.LastPublisher, dto.LastEdit);
+ }
+
+ public static Lesson FromDTOToModel(LessonDTO dto)
+ {
+ return new Lesson(dto.Id, dto.Title, dto.LastPublisher, dto.LastEdit);
+ }
+
+ public static Lesson FromEntityToModel(LessonEntity entity)
+ {
+ return new Lesson(entity.Id, entity.Title, entity.LastPublisher, entity.LastEdit);
+ }
+}
\ No newline at end of file
diff --git a/API_SQLuedo/Shared/Mapper/NotepadMapper.cs b/API_SQLuedo/Shared/Mapper/NotepadMapper.cs
new file mode 100644
index 0000000..ba8aa08
--- /dev/null
+++ b/API_SQLuedo/Shared/Mapper/NotepadMapper.cs
@@ -0,0 +1,40 @@
+using Dto;
+using Entities;
+using ModelToEntities.Business;
+
+namespace Shared.Mapper;
+
+public static class NotepadMapper
+{
+ public static Notepad FromDTOToModel(this NotepadDTO dto)
+ {
+ return new Notepad(dto.Id, dto.UserId, dto.InquiryId, dto.Notes);
+ }
+
+ public static Notepad FromEntityToModel(this NotepadEntity ent)
+ {
+ return new Notepad(ent.Id, ent.UserId, ent.InquiryId, ent.Notes);
+ }
+
+ public static NotepadDTO FromModelToDTO(this Notepad not)
+ {
+ return new NotepadDTO(not.Id, not.UserId, not.InquiryId, not.Notes);
+ }
+
+ public static NotepadDTO FromEntityToDTO(this NotepadEntity ent)
+ {
+ return new NotepadDTO(ent.Id, ent.UserId, ent.InquiryId, ent.Notes);
+ }
+
+ public static NotepadEntity FromDTOToEntity(this NotepadDTO dto)
+ {
+ return new NotepadEntity(dto.Id, new UserEntity(dto.UserId), dto.UserId, new InquiryEntity(dto.InquiryId),
+ dto.Notes);
+ }
+
+ public static NotepadEntity FromModelToEntity(this Notepad not)
+ {
+ return new NotepadEntity(not.Id, new UserEntity(not.UserId), not.UserId, new InquiryEntity(not.InquiryId),
+ not.Notes);
+ }
+}
\ No newline at end of file
diff --git a/API_SQLuedo/Shared/Mapper/ParagraphMapper.cs b/API_SQLuedo/Shared/Mapper/ParagraphMapper.cs
new file mode 100644
index 0000000..0afa24d
--- /dev/null
+++ b/API_SQLuedo/Shared/Mapper/ParagraphMapper.cs
@@ -0,0 +1,38 @@
+using Dto;
+using Entities;
+using ModelToEntities.Business;
+
+namespace Shared.Mapper;
+
+public static class ParagraphMapper
+{
+ public static Paragraph FromDTOToModel(ParagraphDTO dto)
+ {
+ return new Paragraph(dto.Id, dto.Title, dto.Content, dto.Info, dto.Query, dto.Comment);
+ }
+
+ public static Paragraph FromEntityToModel(ParagraphEntity model)
+ {
+ return new Paragraph(model.Id, model.Title, model.Content, model.Info, model.Query, model.Comment);
+ }
+
+ public static ParagraphDTO FromEntityToDTO(ParagraphEntity model)
+ {
+ return new ParagraphDTO(model.Id, model.Title, model.Content, model.Info, model.Query, model.Comment);
+ }
+
+ public static ParagraphDTO FromModelToDTO(Paragraph model)
+ {
+ return new ParagraphDTO(model.Id, model.Title, model.Content, model.Info, model.Query, model.Comment);
+ }
+
+ public static ParagraphEntity FromDTOToEntity(ParagraphDTO dto)
+ {
+ return new ParagraphEntity(dto.Id, dto.Title, dto.Content, dto.Info, dto.Query, dto.Comment);
+ }
+
+ public static Paragraph FromModelToEntity(Paragraph model)
+ {
+ return new Paragraph(model.Id, model.Title, model.Content, model.Info, model.Query, model.Comment);
+ }
+}
\ No newline at end of file
diff --git a/API_SQLuedo/Shared/Mapper/SolutionMapper.cs b/API_SQLuedo/Shared/Mapper/SolutionMapper.cs
new file mode 100644
index 0000000..4d99120
--- /dev/null
+++ b/API_SQLuedo/Shared/Mapper/SolutionMapper.cs
@@ -0,0 +1,44 @@
+using Dto;
+using Entities;
+using ModelToEntities.Business;
+
+namespace Shared.Mapper;
+
+public static class SolutionMapper
+{
+ public static Solution FromDTOToModel(this SolutionDTO dto)
+ {
+ return new Solution(dto.OwnerId, dto.MurdererFirstName, dto.MurdererLastName, dto.MurderPlace, dto.MurderWeapon,
+ dto.Explanation);
+ }
+
+ public static Solution FromEntityToModel(this SolutionEntity entity)
+ {
+ return new Solution(entity.OwnerId, entity.MurdererFirstName, entity.MurdererLastName, entity.MurderPlace,
+ entity.MurderWeapon, entity.Explanation);
+ }
+
+ public static SolutionDTO FromModelToDTO(this Solution model)
+ {
+ return new SolutionDTO(model.OwnerId, model.MurdererFirstName, model.MurdererLastName, model.MurderPlace,
+ model.MurderWeapon, model.Explanation);
+ }
+
+ public static SolutionDTO FromEntityToDTO(this SolutionEntity entity)
+ {
+ return new SolutionDTO(entity.OwnerId, entity.MurdererFirstName, entity.MurdererLastName, entity.MurderPlace,
+ entity.MurderWeapon, entity.Explanation);
+ }
+
+ public static SolutionEntity FromModelToEntity(this Solution model)
+ {
+ return new SolutionEntity(model.OwnerId, new InquiryEntity(model.OwnerId), model.MurdererFirstName,
+ model.MurdererLastName, model.MurderPlace, model.MurderWeapon, model.Explanation);
+ }
+
+ public static SolutionEntity FromDTOToEntity(this SolutionDTO dto)
+ {
+ return new SolutionEntity(dto.OwnerId, new InquiryEntity(dto.OwnerId), dto.MurdererFirstName,
+ dto.MurdererLastName, dto.MurderPlace, dto.MurderWeapon, dto.Explanation);
+ }
+}
\ No newline at end of file
diff --git a/API_SQLuedo/Shared/Mapper/SuccessMapper.cs b/API_SQLuedo/Shared/Mapper/SuccessMapper.cs
new file mode 100644
index 0000000..a6d0261
--- /dev/null
+++ b/API_SQLuedo/Shared/Mapper/SuccessMapper.cs
@@ -0,0 +1,40 @@
+using Dto;
+using Entities;
+using ModelToEntities.Business;
+
+namespace Shared.Mapper;
+
+public static class SuccessMapper
+{
+ public static Success FromDTOToModel(this SuccessDTO dto)
+ {
+ return new Success(dto.UserId, dto.InquiryId, dto.IsFinished);
+ }
+
+ public static Success FromEntityToModel(this SuccessEntity ent)
+ {
+ return new Success(ent.UserId, ent.InquiryId, ent.IsFinished);
+ }
+
+ public static SuccessDTO FromModelToDTO(this Success suc)
+ {
+ return new SuccessDTO(suc.UserId, suc.InquiryId, suc.IsFinished);
+ }
+
+ public static SuccessDTO FromEntityToDTO(this SuccessEntity ent)
+ {
+ return new SuccessDTO(ent.UserId, ent.InquiryId, ent.IsFinished);
+ }
+
+ public static SuccessEntity FromDTOToEntity(this SuccessDTO dto)
+ {
+ return new SuccessEntity(dto.UserId, new UserEntity(dto.UserId), dto.InquiryId,
+ new InquiryEntity(dto.InquiryId), dto.IsFinished);
+ }
+
+ public static SuccessEntity FromModelToEntity(this Success suc)
+ {
+ return new SuccessEntity(suc.UserId, new UserEntity(suc.UserId), suc.InquiryId,
+ new InquiryEntity(suc.InquiryId), suc.IsFinished);
+ }
+}
\ No newline at end of file
diff --git a/API_SQLuedo/Shared/Mapper/UserMapper.cs b/API_SQLuedo/Shared/Mapper/UserMapper.cs
new file mode 100644
index 0000000..a9d4350
--- /dev/null
+++ b/API_SQLuedo/Shared/Mapper/UserMapper.cs
@@ -0,0 +1,38 @@
+using Dto;
+using Entities;
+using ModelToEntities.Business;
+
+namespace Shared.Mapper;
+
+public static class UserMapper
+{
+ public static User FromDTOToModel(this UserDTO dto)
+ {
+ return new User(dto.Id, dto.Username, dto.Password, dto.Email, dto.IsAdmin);
+ }
+
+ public static UserEntity FromDTOToEntity(this UserDTO dto)
+ {
+ return new UserEntity(dto.Id, dto.Username, dto.Password, dto.Email, dto.IsAdmin);
+ }
+
+ public static User FromEntityToModel(this UserEntity entity)
+ {
+ return new User(entity.Id, entity.Username, entity.Password, entity.Email, entity.IsAdmin);
+ }
+
+ public static UserDTO FromEntityToDTO(this UserEntity entity)
+ {
+ return new UserDTO(entity.Id, entity.Username, entity.Password, entity.Email, entity.IsAdmin);
+ }
+
+ public static UserDTO FromModelToDTO(this User user)
+ {
+ return new UserDTO(user.Id, user.Username, user.Password, user.Email, user.IsAdmin);
+ }
+
+ public static UserEntity FromModelToEntity(this User user)
+ {
+ return new UserEntity(user.Id, user.Username, user.Password, user.Email, user.IsAdmin);
+ }
+}
\ No newline at end of file
diff --git a/API_SQLuedo/Shared/Shared.csproj b/API_SQLuedo/Shared/Shared.csproj
index 3a63532..7db1a18 100644
--- a/API_SQLuedo/Shared/Shared.csproj
+++ b/API_SQLuedo/Shared/Shared.csproj
@@ -6,4 +6,10 @@
enable
+
+
+
+
+
+
diff --git a/API_SQLuedo/StubbedContextLib/StubbedContextLib.csproj b/API_SQLuedo/StubbedContextLib/StubbedContextLib.csproj
index 19a69a6..c87b24a 100644
--- a/API_SQLuedo/StubbedContextLib/StubbedContextLib.csproj
+++ b/API_SQLuedo/StubbedContextLib/StubbedContextLib.csproj
@@ -10,4 +10,11 @@
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
diff --git a/API_SQLuedo/TestConsoleAPI/Program.cs b/API_SQLuedo/TestConsoleAPI/Program.cs
index 50fd3a5..cbe8925 100644
--- a/API_SQLuedo/TestConsoleAPI/Program.cs
+++ b/API_SQLuedo/TestConsoleAPI/Program.cs
@@ -3,13 +3,12 @@
using API.Controllers;
using API.Service;
using DbContextLib;
+using DbDataManager.Service;
using Dto;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using ModelToEntities.Service;
var connection = new SqliteConnection("DataSource=:memory:");
connection.Open();
diff --git a/API_SQLuedo/TestConsoleAPI/TestConsoleAPI.csproj b/API_SQLuedo/TestConsoleAPI/TestConsoleAPI.csproj
index 801193b..fa9db2a 100644
--- a/API_SQLuedo/TestConsoleAPI/TestConsoleAPI.csproj
+++ b/API_SQLuedo/TestConsoleAPI/TestConsoleAPI.csproj
@@ -14,7 +14,7 @@
-
+