diff --git a/Condo/Condo.csproj b/Condo/Condo.csproj
new file mode 100644
index 0000000..e608e36
--- /dev/null
+++ b/Condo/Condo.csproj
@@ -0,0 +1,19 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
+
+
+
diff --git a/Condo/Context/DatabaseContext.cs b/Condo/Context/DatabaseContext.cs
new file mode 100644
index 0000000..bcbf553
--- /dev/null
+++ b/Condo/Context/DatabaseContext.cs
@@ -0,0 +1,28 @@
+using Condo.Context.Interfaces;
+using Condo.Models;
+using Microsoft.EntityFrameworkCore;
+
+namespace Condo.Context;
+
+public class DatabaseContext : DbContext, IDatabaseContext
+{
+ public DatabaseContext(DbContextOptions options) : base(options) {
+
+ }
+ public DatabaseContext() {}
+
+ public DbSet Condominiums { get; set; } = null!;
+
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ if (!optionsBuilder.IsConfigured)
+ {
+ var connectionString = "Server=localhost;Database=Condo;User=SA;Password=SqlCondol12345!;TrustServerCertificate=True";
+ optionsBuilder.UseSqlServer(connectionString);
+ }
+ }
+
+
+
+
+}
\ No newline at end of file
diff --git a/Condo/Context/Interfaces/IDatabaseContext.cs b/Condo/Context/Interfaces/IDatabaseContext.cs
new file mode 100644
index 0000000..bf061b5
--- /dev/null
+++ b/Condo/Context/Interfaces/IDatabaseContext.cs
@@ -0,0 +1,11 @@
+using Condo.Models;
+using Microsoft.EntityFrameworkCore;
+
+namespace Condo.Context.Interfaces;
+
+public interface IDatabaseContext
+{
+ public DbSet Condominiums { get; set; }
+ public int SaveChanges();
+
+}
\ No newline at end of file
diff --git a/Condo/Controllers/CondominiumController.cs b/Condo/Controllers/CondominiumController.cs
new file mode 100644
index 0000000..2bb5339
--- /dev/null
+++ b/Condo/Controllers/CondominiumController.cs
@@ -0,0 +1,28 @@
+using Condo.Models;
+using Condo.UseCases.Interfaces;
+using Microsoft.AspNetCore.Mvc;
+
+namespace Condo.Controllers;
+
+[ApiController]
+[Route("[controller]")]
+public class CondominiumController : ControllerBase
+{
+ protected readonly ICondominiumUseCase _useCase;
+ public CondominiumController(ICondominiumUseCase useCase)
+ {
+ _useCase = useCase;
+ }
+
+ [HttpGet]
+ public IActionResult Get()
+ {
+ return Ok(_useCase.Get());
+ }
+
+ [HttpPost]
+ public IActionResult Post([FromBody] Condominium condominium)
+ {
+ return Created("", _useCase.Add(condominium));
+ }
+}
\ No newline at end of file
diff --git a/Condo/Migrations/20240429021611_InitialCreate.Designer.cs b/Condo/Migrations/20240429021611_InitialCreate.Designer.cs
new file mode 100644
index 0000000..b5e43e7
--- /dev/null
+++ b/Condo/Migrations/20240429021611_InitialCreate.Designer.cs
@@ -0,0 +1,51 @@
+//
+using Condo.Context;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace Condo.Migrations
+{
+ [DbContext(typeof(DatabaseContext))]
+ [Migration("20240429021611_InitialCreate")]
+ partial class InitialCreate
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.4")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("Condo.Models.Condominium", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PropertyTax")
+ .HasColumnType("float");
+
+ b.Property("Type")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("Condominiums");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Condo/Migrations/20240429021611_InitialCreate.cs b/Condo/Migrations/20240429021611_InitialCreate.cs
new file mode 100644
index 0000000..52445b9
--- /dev/null
+++ b/Condo/Migrations/20240429021611_InitialCreate.cs
@@ -0,0 +1,36 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace Condo.Migrations
+{
+ ///
+ public partial class InitialCreate : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "Condominiums",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ Name = table.Column(type: "nvarchar(max)", nullable: true),
+ Type = table.Column(type: "int", nullable: false),
+ PropertyTax = table.Column(type: "float", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Condominiums", x => x.Id);
+ });
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "Condominiums");
+ }
+ }
+}
diff --git a/Condo/Migrations/DatabaseContextModelSnapshot.cs b/Condo/Migrations/DatabaseContextModelSnapshot.cs
new file mode 100644
index 0000000..1d42539
--- /dev/null
+++ b/Condo/Migrations/DatabaseContextModelSnapshot.cs
@@ -0,0 +1,48 @@
+//
+using Condo.Context;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace Condo.Migrations
+{
+ [DbContext(typeof(DatabaseContext))]
+ partial class DatabaseContextModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.4")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("Condo.Models.Condominium", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PropertyTax")
+ .HasColumnType("float");
+
+ b.Property("Type")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("Condominiums");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Condo/Models/Condominium.cs b/Condo/Models/Condominium.cs
new file mode 100644
index 0000000..b3bdb16
--- /dev/null
+++ b/Condo/Models/Condominium.cs
@@ -0,0 +1,11 @@
+using Condo.Types;
+
+namespace Condo.Models;
+
+public class Condominium
+{
+ public int Id { get; set; }
+ public string? Name { get; set; }
+ public CondoType Type { get; set; }
+ public double PropertyTax { get; set; }
+}
\ No newline at end of file
diff --git a/Condo/Program.cs b/Condo/Program.cs
new file mode 100644
index 0000000..373b7bf
--- /dev/null
+++ b/Condo/Program.cs
@@ -0,0 +1,36 @@
+using Condo.Context;
+using Condo.Context.Interfaces;
+using Condo.Repository;
+using Condo.Repository.Interfaces;
+using Condo.UseCases;
+using Condo.UseCases.Interfaces;
+
+var builder = WebApplication.CreateBuilder(args);
+
+// Add services to the container.
+
+builder.Services.AddControllers();
+// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
+builder.Services.AddEndpointsApiExplorer();
+builder.Services.AddSwaggerGen();
+builder.Services.AddDbContext();
+builder.Services.AddScoped();
+builder.Services.AddScoped();
+builder.Services.AddScoped();
+
+var app = builder.Build();
+
+// Configure the HTTP request pipeline.
+if (app.Environment.IsDevelopment())
+{
+ app.UseSwagger();
+ app.UseSwaggerUI();
+}
+
+app.UseHttpsRedirection();
+
+app.UseAuthorization();
+
+app.MapControllers();
+
+app.Run();
diff --git a/Condo/Properties/launchSettings.json b/Condo/Properties/launchSettings.json
new file mode 100644
index 0000000..a4ba4cf
--- /dev/null
+++ b/Condo/Properties/launchSettings.json
@@ -0,0 +1,41 @@
+{
+ "$schema": "https://json.schemastore.org/launchsettings.json",
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:2529",
+ "sslPort": 44374
+ }
+ },
+ "profiles": {
+ "http": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "applicationUrl": "http://localhost:5087",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "https": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "applicationUrl": "https://localhost:7024;http://localhost:5087",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "IIS Express": {
+ "commandName": "IISExpress",
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ }
+ }
+}
diff --git a/Condo/Repository/CondominiumRepository.cs b/Condo/Repository/CondominiumRepository.cs
new file mode 100644
index 0000000..7d5e033
--- /dev/null
+++ b/Condo/Repository/CondominiumRepository.cs
@@ -0,0 +1,26 @@
+using Condo.Context.Interfaces;
+using Condo.Models;
+using Condo.Repository.Interfaces;
+
+namespace Condo.Repository;
+
+public class CondominiumRepository : ICondominiumRepository
+{
+ protected readonly IDatabaseContext _context;
+
+ public CondominiumRepository(IDatabaseContext context)
+ {
+ _context = context;
+ }
+ public Condominium Add(Condominium condominium)
+ {
+ _context.Condominiums.Add(condominium);
+ _context.SaveChanges();
+ return condominium;
+ }
+
+ public IEnumerable Get()
+ {
+ return _context.Condominiums;
+ }
+}
\ No newline at end of file
diff --git a/Condo/Repository/Interfaces/ICondominiumRepository.cs b/Condo/Repository/Interfaces/ICondominiumRepository.cs
new file mode 100644
index 0000000..d54ef9d
--- /dev/null
+++ b/Condo/Repository/Interfaces/ICondominiumRepository.cs
@@ -0,0 +1,9 @@
+using Condo.Models;
+
+namespace Condo.Repository.Interfaces;
+
+public interface ICondominiumRepository
+{
+ IEnumerableGet();
+ Condominium Add(Condominium condominium);
+}
\ No newline at end of file
diff --git a/Condo/Types/CondoType.cs b/Condo/Types/CondoType.cs
new file mode 100644
index 0000000..1914e31
--- /dev/null
+++ b/Condo/Types/CondoType.cs
@@ -0,0 +1,7 @@
+namespace Condo.Types;
+
+public enum CondoType
+{
+ Residential = 0,
+ Commercial
+}
\ No newline at end of file
diff --git a/Condo/UseCases/CondominiumUseCase.cs b/Condo/UseCases/CondominiumUseCase.cs
new file mode 100644
index 0000000..03beaa3
--- /dev/null
+++ b/Condo/UseCases/CondominiumUseCase.cs
@@ -0,0 +1,22 @@
+namespace Condo.UseCases;
+using Condo.UseCases.Interfaces;
+using Condo.Repository.Interfaces;
+using Condo.Models;
+
+public class CondominiumUseCase : ICondominiumUseCase
+{
+ protected readonly ICondominiumRepository _repository;
+ public CondominiumUseCase(ICondominiumRepository repository)
+ {
+ _repository = repository;
+ }
+
+ public IEnumerable Get()
+ {
+ return _repository.Get();
+ }
+ public Condominium Add(Condominium condominium)
+ {
+ return _repository.Add(condominium);
+ }
+}
\ No newline at end of file
diff --git a/Condo/UseCases/Interfaces/ICondominiumUseCase.cs b/Condo/UseCases/Interfaces/ICondominiumUseCase.cs
new file mode 100644
index 0000000..77f2922
--- /dev/null
+++ b/Condo/UseCases/Interfaces/ICondominiumUseCase.cs
@@ -0,0 +1,9 @@
+using Condo.Models;
+
+namespace Condo.UseCases.Interfaces;
+
+public interface ICondominiumUseCase
+{
+ IEnumerable Get();
+ Condominium Add(Condominium condominium);
+}
\ No newline at end of file
diff --git a/Condo/appsettings.Development.json b/Condo/appsettings.Development.json
new file mode 100644
index 0000000..ff66ba6
--- /dev/null
+++ b/Condo/appsettings.Development.json
@@ -0,0 +1,8 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ }
+}
diff --git a/Condo/appsettings.json b/Condo/appsettings.json
new file mode 100644
index 0000000..4d56694
--- /dev/null
+++ b/Condo/appsettings.json
@@ -0,0 +1,9 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ },
+ "AllowedHosts": "*"
+}
diff --git a/CondoProject.sln b/CondoProject.sln
new file mode 100644
index 0000000..9f2fe4e
--- /dev/null
+++ b/CondoProject.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.5.002.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Condo", "Condo\Condo.csproj", "{82D7C556-06F1-49A7-9DFF-42F388E39D48}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {82D7C556-06F1-49A7-9DFF-42F388E39D48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {82D7C556-06F1-49A7-9DFF-42F388E39D48}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {82D7C556-06F1-49A7-9DFF-42F388E39D48}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {82D7C556-06F1-49A7-9DFF-42F388E39D48}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {34194A8E-B00B-4478-AB99-03861410CAFE}
+ EndGlobalSection
+EndGlobal
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..85ba418
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,11 @@
+version: '3'
+services:
+ db:
+ image: mcr.microsoft.com/azure-sql-edge:latest
+ container_name: condo_db
+ ports:
+ - 1433:1433
+ environment:
+ - ACCEPT_EULA=Y
+ - MSSQL_SA_PASSWORD=SqlCondol12345!
+ - MSSQL_PID=Developer
\ No newline at end of file