Skip to content

Commit

Permalink
Add project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
xmione committed Mar 12, 2024
1 parent 70d7965 commit 48c9571
Show file tree
Hide file tree
Showing 198 changed files with 95,821 additions and 0 deletions.
12 changes: 12 additions & 0 deletions AccSol.API/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "8.0.1",
"commands": [
"dotnet-ef"
]
}
}
}
Empty file added AccSol.API/.editorconfig
Empty file.
40 changes: 40 additions & 0 deletions AccSol.API/AccSol.API.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>false</InvariantGlobalization>
<UserSecretsId>061a22dd-f9a4-46cb-aec9-d2cde7df618f</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AccSol.EF\AccSol.EF.csproj" />
<ProjectReference Include="..\AccSol.Reports.ExcelFiles\AccSol.Reports.ExcelFiles.csproj" />
<ProjectReference Include="..\AccSol.Repositories\AccSol.Repositories.csproj" />
<ProjectReference Include="..\AccSol.ViewModels\AccSol.ViewModels.csproj" />
</ItemGroup>

<ItemGroup>
<EditorConfigFiles Remove="C:\repo\AccSol\AccSol.API\.editorconfig" />
</ItemGroup>

<ItemGroup>
<None Include="C:\repo\AccSol\AccSol.API\.editorconfig" />
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions AccSol.API/AccSol.API.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@AccSol.API_HostAddress = http://localhost:5049

GET {{AccSol.API_HostAddress}}/weatherforecast/
Accept: application/json

###
95 changes: 95 additions & 0 deletions AccSol.API/Controllers/ClientsController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
using Microsoft.AspNetCore.Mvc;
using AccSol.Models;
using AccSol.Repositories;

namespace AccSol.API.Controllers
{
[ApiController]
[Route("[controller]")]
public class ClientsController : ControllerBase
{
private readonly IRepositoryManager _repository;
public ClientsController(IRepositoryManager repository)
{
_repository = repository;
}


[HttpGet("GetAll")]
public ActionResult<IEnumerable<Client>> GetAll()
{
try
{
var list = _repository.Client.GetAll(trackChanges: false);

return Ok(list);
} catch (Exception ex)
{
return StatusCode(500, ex.Message);
}

}

// GET: Clients/GetById/5
[HttpPost("Get")]
public ActionResult<Client?> Get([FromBody] int? id)
{
try
{
Client? client = null;
if (id != null)
{
client = _repository.Client.Get(id, trackChanges: false);

}

return Ok(client);
}
catch (Exception ex)
{
return StatusCode(500, ex.Message);
}
}
[HttpPost("Save")]
public IActionResult Save([FromBody] Client? client)
{
try
{
if (client != null)
{
_repository.Client.SaveClient(client);

}

return Ok(client);

}
catch (Exception ex)
{
return StatusCode(500, ex.Message);
}
}

[HttpPost("Delete")]
public IActionResult Delete([FromBody] int? id)
{
try
{
if (id != null)
{
var client = _repository.Client.Get(id, false);
if (client != null)
{
_repository.Client.DeleteClient(client);
}
}

return Ok(id);
}
catch (Exception ex)
{
return StatusCode(500, ex.Message);
}
}
}
}
88 changes: 88 additions & 0 deletions AccSol.API/Controllers/CoasController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
using Microsoft.AspNetCore.Mvc;
using AccSol.Models;
using AccSol.Repositories;

namespace AccSol.API.Controllers
{
[ApiController]
[Route("[controller]")]
public class CoasController : ControllerBase
{
private readonly IRepositoryManager _repository;
public CoasController(IRepositoryManager repository)
{
_repository = repository;
}


[HttpGet("GetAll")]
public ActionResult<IEnumerable<Coa>> GetAll()
{
var list = _repository.Coa.GetAll(trackChanges: false);

return Ok(list);
}

// GET: Coas/GetById/5
[HttpPost("Get")]
public ActionResult<Coa?> Get([FromBody] int? id)
{
try
{
Coa? coa = null;
if (id != null)
{
coa = _repository.Coa.Get(id, trackChanges: false);

}

return Ok(coa);
}
catch (Exception ex)
{
return StatusCode(500, ex.Message);
}
}
[HttpPost("Save")]
public IActionResult Save([FromBody] Coa? coa)
{
try
{
if (coa != null)
{
_repository.Coa.SaveCoa(coa);

}

return Ok(coa);

}
catch (Exception ex)
{
return StatusCode(500, ex.Message);
}
}

[HttpPost("Delete")]
public IActionResult Delete([FromBody] int? id)
{
try
{
if (id != null)
{
var coa = _repository.Coa.Get(id, false);
if (coa != null)
{
_repository.Coa.DeleteCoa(coa);
}
}

return Ok(id);
}
catch (Exception ex)
{
return StatusCode(500, ex.Message);
}
}
}
}
81 changes: 81 additions & 0 deletions AccSol.API/Controllers/DepartmentsController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
using Microsoft.AspNetCore.Mvc;
using AccSol.Models;
using AccSol.Repositories;

namespace AccSol.API.Controllers
{
[ApiController]
[Route("[controller]")]
public class DepartmentsController : ControllerBase
{
private readonly IRepositoryManager _repository;
public DepartmentsController(IRepositoryManager repository)
{
_repository = repository;
}


[HttpGet("GetAll")]
public ActionResult<IEnumerable<Department>> GetAll()
{
var list = _repository.Department.GetAll(trackChanges: false);

return Ok(list);
}

// GET: Departments/GetById/5
[HttpGet("Get/{id}")]
public ActionResult<Department?> Get(int id)
{
try
{
Department? department = _repository.Department.Get(id, trackChanges: false);
return Ok(department);
}
catch (Exception ex)
{
return StatusCode(500, ex.Message);
}
}
[HttpPost("Save")]
public IActionResult Save([FromBody] Department? department)
{
try
{
if (department != null)
{
_repository.Department.SaveDepartment(department);
}

return Ok(department);

}
catch (Exception ex)
{
return StatusCode(500, ex.Message);
}
}

[HttpPost("Delete")]
public IActionResult Delete([FromBody] int? id)
{
try
{
if (id != null)
{
var department = _repository.Department.Get(id, false);
if (department != null)
{
_repository.Department.DeleteDepartment(department);
}
}

return Ok(id);
}
catch (Exception ex)
{
return StatusCode(500, ex.Message);
}
}
}
}
Loading

0 comments on commit 48c9571

Please sign in to comment.