Index: iknow-api/Controllers/UsersControllers.cs
===================================================================
--- iknow-api/Controllers/UsersControllers.cs	(revision c0a75ab79359b9207c8de7c51661e454d4b4cfee)
+++ iknow-api/Controllers/UsersControllers.cs	(revision aed1148de53fbc2e66052413bd4dbd2bc57b1edf)
@@ -1,7 +1,8 @@
-//using iknow_api.Data;
-using iknow_api.Models;
+using iknow_api.Core.Models;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
-
+using iknow_api.Core.Data;
+using iknow_api.Repository.Interfaces;
+using iknow_api.Core.Interfaces;
 
 namespace iknow_api.Controllers
@@ -11,20 +12,26 @@
     public class UsersController : ControllerBase
     {
-        private readonly AppDbContext _context;
-        private readonly IConfiguration _configuration;
+        private readonly IUserService _users;
 
-        public UsersController(AppDbContext context, IConfiguration configuration)
+        public UsersController(IUserService users)
         {
-            _context = context;
-            _configuration = configuration;
+            _users = users;
         }
 
         [HttpPost("add")]
-        public async Task<IActionResult> Add([FromBody] JsonContent body)
+        public async Task<IActionResult> Add([FromBody] User user)
         {
-            
-            return null;
+            var created = await _users.AddUserAsync(user);
+            return Ok(created);
         }
 
+        [HttpGet("id/{id}")]
+        public async Task<IActionResult> GetById(int id)
+        {
+            var user = await _users.GetUserByIdAsync(id);
+            if (user == null)
+                return NotFound();
+            return Ok(user);
+        }
     }
 }
Index: iknow-api/Data/AppDbContext.cs
===================================================================
--- iknow-api/Data/AppDbContext.cs	(revision c0a75ab79359b9207c8de7c51661e454d4b4cfee)
+++ iknow-api/Data/AppDbContext.cs	(revision aed1148de53fbc2e66052413bd4dbd2bc57b1edf)
@@ -1,10 +1,13 @@
 using Microsoft.EntityFrameworkCore;
-using iknow_api.Models;
+using iknow_api.Core.Models;
 
-public class AppDbContext : DbContext
+namespace iknow_api.Core.Data
 {
-    public AppDbContext(DbContextOptions<AppDbContext> options)
-        : base(options) { }
+    public class AppDbContext : DbContext
+    {
+        public AppDbContext(DbContextOptions<AppDbContext> options)
+            : base(options) { }
 
-    public DbSet<Users> Users { get; set; }
+        public DbSet<User> User { get; set; }
+    }
 }
Index: iknow-api/Data/AppDbContextFactory.cs
===================================================================
--- iknow-api/Data/AppDbContextFactory.cs	(revision c0a75ab79359b9207c8de7c51661e454d4b4cfee)
+++ 	(revision )
@@ -1,21 +1,0 @@
-//using Microsoft.EntityFrameworkCore;
-//using Microsoft.EntityFrameworkCore.Design;
-
-//namespace iknow_api.Data
-//{
-//    public class AppDbContextFactory : IDesignTimeDbContextFactory<AppDbContext>
-//    {
-//        public AppDbContext CreateDbContext(string[] args)
-//        {
-//            var configuration = new ConfigurationBuilder()
-//                .SetBasePath(Directory.GetCurrentDirectory())
-//                .AddJsonFile("appsettings.json")
-//                .Build();
-
-//            var optionsBuilder = new DbContextOptionsBuilder<AppDbContext>();
-//            optionsBuilder.UseNpgsql(configuration.GetConnectionString("DefaultConnection"));
-
-//            return new AppDbContext(optionsBuilder.Options);
-//        }
-//    }
-//}
Index: iknow-api/Migrations/20251020130122_InitialCreate.Designer.cs
===================================================================
--- iknow-api/Migrations/20251020130122_InitialCreate.Designer.cs	(revision c0a75ab79359b9207c8de7c51661e454d4b4cfee)
+++ 	(revision )
@@ -1,66 +1,0 @@
-﻿// <auto-generated />
-using System;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-#nullable disable
-
-namespace iknow_api.Migrations
-{
-    [DbContext(typeof(AppDbContext))]
-    [Migration("20251020130122_InitialCreate")]
-    partial class InitialCreate
-    {
-        /// <inheritdoc />
-        protected override void BuildTargetModel(ModelBuilder modelBuilder)
-        {
-#pragma warning disable 612, 618
-            modelBuilder
-                .HasAnnotation("ProductVersion", "9.0.10")
-                .HasAnnotation("Relational:MaxIdentifierLength", 63);
-
-            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
-
-            modelBuilder.Entity("iknow_api.Models.Users", b =>
-                {
-                    b.Property<int>("Id")
-                        .ValueGeneratedOnAdd()
-                        .HasColumnType("integer");
-
-                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
-                    b.Property<DateTime>("Bday")
-                        .HasColumnType("timestamp with time zone");
-
-                    b.Property<DateTime>("CreatedAt")
-                        .HasColumnType("timestamp with time zone");
-
-                    b.Property<string>("Email")
-                        .HasColumnType("text");
-
-                    b.Property<string>("Index")
-                        .HasColumnType("text");
-
-                    b.Property<string>("Name")
-                        .HasColumnType("text");
-
-                    b.Property<string>("Password")
-                        .HasColumnType("text");
-
-                    b.Property<int>("Role")
-                        .HasColumnType("integer");
-
-                    b.Property<string>("Surname")
-                        .HasColumnType("text");
-
-                    b.HasKey("Id");
-
-                    b.ToTable("Users");
-                });
-#pragma warning restore 612, 618
-        }
-    }
-}
Index: iknow-api/Migrations/20251020130122_InitialCreate.cs
===================================================================
--- iknow-api/Migrations/20251020130122_InitialCreate.cs	(revision c0a75ab79359b9207c8de7c51661e454d4b4cfee)
+++ 	(revision )
@@ -1,43 +1,0 @@
-﻿using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-#nullable disable
-
-namespace iknow_api.Migrations
-{
-    /// <inheritdoc />
-    public partial class InitialCreate : Migration
-    {
-        /// <inheritdoc />
-        protected override void Up(MigrationBuilder migrationBuilder)
-        {
-            migrationBuilder.CreateTable(
-                name: "Users",
-                columns: table => new
-                {
-                    Id = table.Column<int>(type: "integer", nullable: false)
-                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
-                    Name = table.Column<string>(type: "text", nullable: true),
-                    Surname = table.Column<string>(type: "text", nullable: true),
-                    Index = table.Column<string>(type: "text", nullable: true),
-                    Email = table.Column<string>(type: "text", nullable: true),
-                    Password = table.Column<string>(type: "text", nullable: true),
-                    Bday = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
-                    CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
-                    Role = table.Column<int>(type: "integer", nullable: false)
-                },
-                constraints: table =>
-                {
-                    table.PrimaryKey("PK_Users", x => x.Id);
-                });
-        }
-
-        /// <inheritdoc />
-        protected override void Down(MigrationBuilder migrationBuilder)
-        {
-            migrationBuilder.DropTable(
-                name: "Users");
-        }
-    }
-}
Index: iknow-api/Migrations/20251021141534_InitialCreate.Designer.cs
===================================================================
--- iknow-api/Migrations/20251021141534_InitialCreate.Designer.cs	(revision aed1148de53fbc2e66052413bd4dbd2bc57b1edf)
+++ iknow-api/Migrations/20251021141534_InitialCreate.Designer.cs	(revision aed1148de53fbc2e66052413bd4dbd2bc57b1edf)
@@ -0,0 +1,67 @@
+﻿// <auto-generated />
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+using iknow_api.Core.Data;
+
+#nullable disable
+
+namespace iknow_api.Migrations
+{
+    [DbContext(typeof(AppDbContext))]
+    [Migration("20251021141534_InitialCreate")]
+    partial class InitialCreate
+    {
+        /// <inheritdoc />
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .HasAnnotation("ProductVersion", "9.0.10")
+                .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+            modelBuilder.Entity("iknow_api.Core.Models.User", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("integer");
+
+                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
+
+                    b.Property<DateTime>("Bday")
+                        .HasColumnType("timestamp with time zone");
+
+                    b.Property<DateTime>("CreatedAt")
+                        .HasColumnType("timestamp with time zone");
+
+                    b.Property<string>("Email")
+                        .HasColumnType("text");
+
+                    b.Property<string>("Index")
+                        .HasColumnType("text");
+
+                    b.Property<string>("Name")
+                        .HasColumnType("text");
+
+                    b.Property<string>("Password")
+                        .HasColumnType("text");
+
+                    b.Property<int>("Role")
+                        .HasColumnType("integer");
+
+                    b.Property<string>("Surname")
+                        .HasColumnType("text");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("User");
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}
Index: iknow-api/Migrations/20251021141534_InitialCreate.cs
===================================================================
--- iknow-api/Migrations/20251021141534_InitialCreate.cs	(revision aed1148de53fbc2e66052413bd4dbd2bc57b1edf)
+++ iknow-api/Migrations/20251021141534_InitialCreate.cs	(revision aed1148de53fbc2e66052413bd4dbd2bc57b1edf)
@@ -0,0 +1,43 @@
+﻿using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace iknow_api.Migrations
+{
+    /// <inheritdoc />
+    public partial class InitialCreate : Migration
+    {
+        /// <inheritdoc />
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.CreateTable(
+                name: "User",
+                columns: table => new
+                {
+                    Id = table.Column<int>(type: "integer", nullable: false)
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+                    Name = table.Column<string>(type: "text", nullable: true),
+                    Surname = table.Column<string>(type: "text", nullable: true),
+                    Index = table.Column<string>(type: "text", nullable: true),
+                    Email = table.Column<string>(type: "text", nullable: true),
+                    Password = table.Column<string>(type: "text", nullable: true),
+                    Bday = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
+                    CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
+                    Role = table.Column<int>(type: "integer", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_User", x => x.Id);
+                });
+        }
+
+        /// <inheritdoc />
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropTable(
+                name: "User");
+        }
+    }
+}
Index: iknow-api/Migrations/AppDbContextModelSnapshot.cs
===================================================================
--- iknow-api/Migrations/AppDbContextModelSnapshot.cs	(revision c0a75ab79359b9207c8de7c51661e454d4b4cfee)
+++ iknow-api/Migrations/AppDbContextModelSnapshot.cs	(revision aed1148de53fbc2e66052413bd4dbd2bc57b1edf)
@@ -5,4 +5,5 @@
 using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+using iknow_api.Core.Data;
 
 #nullable disable
@@ -22,5 +23,5 @@
             NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
 
-            modelBuilder.Entity("iknow_api.Models.Users", b =>
+            modelBuilder.Entity("iknow_api.Core.Models.User", b =>
                 {
                     b.Property<int>("Id")
@@ -56,5 +57,5 @@
                     b.HasKey("Id");
 
-                    b.ToTable("Users");
+                    b.ToTable("User");
                 });
 #pragma warning restore 612, 618
Index: iknow-api/Models/User.cs
===================================================================
--- iknow-api/Models/User.cs	(revision aed1148de53fbc2e66052413bd4dbd2bc57b1edf)
+++ iknow-api/Models/User.cs	(revision aed1148de53fbc2e66052413bd4dbd2bc57b1edf)
@@ -0,0 +1,24 @@
+
+
+namespace iknow_api.Core.Models
+{
+    public enum UserRole
+    {
+        Admin,
+        Professor,
+        Strudent
+    }
+
+    public class User
+    {
+        public int Id { get; set; }
+        public string? Name { get; set; }
+        public string? Surname { get; set; }
+        public string? Index { get; set; }
+        public string? Email { get; set; }
+        public string? Password { get; set; }
+        public DateTime Bday { get; set; }
+        public DateTime CreatedAt { get; set; }
+        public UserRole Role { get; set; }
+    }
+}
Index: iknow-api/Models/Users.cs
===================================================================
--- iknow-api/Models/Users.cs	(revision c0a75ab79359b9207c8de7c51661e454d4b4cfee)
+++ 	(revision )
@@ -1,24 +1,0 @@
-
-
-namespace iknow_api.Models
-{
-    public enum UserRole
-    {
-        Admin,
-        Professor,
-        Strudent
-    }
-
-    public class Users
-    {
-        public int Id { get; set; }
-        public string? Name { get; set; }
-        public string? Surname { get; set; }
-        public string? Index { get; set; }
-        public string? Email { get; set; }
-        public string? Password { get; set; }
-        public DateTime Bday { get; set; }
-        public DateTime CreatedAt { get; set; }
-        public UserRole Role { get; set; }
-    }
-}
Index: iknow-api/Program.cs
===================================================================
--- iknow-api/Program.cs	(revision c0a75ab79359b9207c8de7c51661e454d4b4cfee)
+++ iknow-api/Program.cs	(revision aed1148de53fbc2e66052413bd4dbd2bc57b1edf)
@@ -1,3 +1,4 @@
 using Microsoft.EntityFrameworkCore;
+using iknow_api.Core.Data;
 
 var builder = WebApplication.CreateBuilder(args);
@@ -9,6 +10,9 @@
 builder.Services.AddOpenApi();
 
+
 builder.Services.AddDbContext<AppDbContext>(options =>
     options.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection")));
+
+builder.Services.AddScoped<iknow_api.Repository.Interfaces.IUserRepository, iknow_api.Repository.UserRepository>();
 
 var app = builder.Build();
@@ -20,5 +24,6 @@
 }
 
-
+builder.Services.AddDbContext<AppDbContext>(options =>
+    options.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection")));
 
     
Index: iknow-api/Repository/Implementations/UserRepository.cs
===================================================================
--- iknow-api/Repository/Implementations/UserRepository.cs	(revision aed1148de53fbc2e66052413bd4dbd2bc57b1edf)
+++ iknow-api/Repository/Implementations/UserRepository.cs	(revision aed1148de53fbc2e66052413bd4dbd2bc57b1edf)
@@ -0,0 +1,32 @@
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.EntityFrameworkCore;
+using iknow_api.Core.Models;
+using iknow_api.Repository.Interfaces;
+using iknow_api.Core.Data;
+
+namespace iknow_api.Repository
+{
+    public class UserRepository : IUserRepository
+    {
+        private readonly AppDbContext _context;
+
+        public UserRepository(AppDbContext context)
+        {
+            _context = context;
+        }
+
+        public Task<bool> EmailExistsAsync(string email, CancellationToken cancellationToken = default)
+            => _context.User.AnyAsync(u => u.Email == email, cancellationToken);
+
+        public async Task<User> AddUserAsync(User user, CancellationToken cancellationToken = default)
+        {
+            await _context.User.AddAsync(user, cancellationToken);
+            await _context.SaveChangesAsync(cancellationToken);
+            return user;
+        }
+
+        public Task<User?> GetUserByIdAsync(int id, CancellationToken cancellationToken = default)
+            => _context.User.FindAsync(new object[] { id }, cancellationToken).AsTask();
+    }
+}
Index: iknow-api/Repository/Interface/IUserRepository.cs
===================================================================
--- iknow-api/Repository/Interface/IUserRepository.cs	(revision aed1148de53fbc2e66052413bd4dbd2bc57b1edf)
+++ iknow-api/Repository/Interface/IUserRepository.cs	(revision aed1148de53fbc2e66052413bd4dbd2bc57b1edf)
@@ -0,0 +1,13 @@
+using System.Threading;
+using System.Threading.Tasks;
+using iknow_api.Core.Models;
+
+namespace iknow_api.Repository.Interfaces
+{
+    public interface IUserRepository
+    {
+        Task<bool> EmailExistsAsync(string email, CancellationToken cancellationToken = default);
+        Task<User> AddUserAsync(User user, CancellationToken cancellationToken = default);
+        Task<User?> GetUserByIdAsync(int id, CancellationToken cancellationToken = default);
+    }
+}
Index: iknow-api/Services/Implementations/UserService.cs
===================================================================
--- iknow-api/Services/Implementations/UserService.cs	(revision c0a75ab79359b9207c8de7c51661e454d4b4cfee)
+++ iknow-api/Services/Implementations/UserService.cs	(revision aed1148de53fbc2e66052413bd4dbd2bc57b1edf)
@@ -1,3 +1,6 @@
-using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using iknow_api.Core.Models;
+using iknow_api.Repository.Interfaces;
+// ...existing code...
 
 namespace iknow_api.Core.Services
@@ -5,12 +8,26 @@
     public class UserService
     {
-        private readonly AppDbContext _context;
+        private readonly IUserRepository _users;
 
-        public UserService(AppDbContext context)
+        public UserService(IUserRepository users)
         {
-            _context = context;
+            _users = users;
         }
 
+        public async Task<User> AddUserAsync(User user, CancellationToken cancellationToken = default)
+        {
+            if (user == null) throw new ArgumentNullException(nameof(user));
 
+            if (!string.IsNullOrWhiteSpace(user.Email))
+            {
+                user.Email = user.Email.Trim();
+
+                var exists = await _users.EmailExistsAsync(user.Email, cancellationToken);
+                if (exists)
+                    throw new InvalidOperationException("A user with this email already exists.");
+            }
+
+            return await _users.AddUserAsync(user, cancellationToken);
+        }
     }
 }
Index: iknow-api/Services/Interfaces/IUserService.cs
===================================================================
--- iknow-api/Services/Interfaces/IUserService.cs	(revision c0a75ab79359b9207c8de7c51661e454d4b4cfee)
+++ iknow-api/Services/Interfaces/IUserService.cs	(revision aed1148de53fbc2e66052413bd4dbd2bc57b1edf)
@@ -1,2 +1,5 @@
+using System.Threading;
+using System.Threading.Tasks;
+using iknow_api.Core.Models;
 
 namespace iknow_api.Core.Interfaces
@@ -4,5 +7,6 @@
     public interface IUserService
     {
-        Task<JsonContent> AddUser(JsonContent newUser);
+        Task<User> AddUserAsync(User user, CancellationToken cancellationToken = default);
+        Task<int> GetUserByIdAsync(int id, CancellationToken cancellationToken = default);
     }
 }
