This commit is contained in:
Frede Hundewadt 2023-12-22 09:15:40 +01:00
parent de360fbbfe
commit e8c5e61d24
4 changed files with 17 additions and 12 deletions

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View file

@ -29,12 +29,14 @@ namespace Ultimate.Presentation.Controllers
[HttpGet("{id:guid}", Name = "GetCompanyById")] [HttpGet("{id:guid}", Name = "GetCompanyById")]
public IActionResult GetCompany(Guid id) { public IActionResult GetCompany(Guid id)
{
{ {
var company = _service.CompanyService.GetCompany(id, trackChanges: false); var company = _service.CompanyService.GetCompany(id, trackChanges: false);
return Ok(company); return Ok(company);
}} }
}
[HttpPost] [HttpPost]
@ -52,7 +54,8 @@ namespace Ultimate.Presentation.Controllers
[HttpGet("collection/({ids})", Name = "CompanyCollection")] [HttpGet("collection/({ids})", Name = "CompanyCollection")]
public IActionResult GetCompanyCollection([ModelBinder(BinderType = typeof(ArrayModelBinder))] IEnumerable<Guid> ids) public IActionResult GetCompanyCollection(
[ModelBinder(BinderType = typeof(ArrayModelBinder))] IEnumerable<Guid> ids)
{ {
var companies = _service.CompanyService.GetByIds(ids, trackChanges: false); var companies = _service.CompanyService.GetByIds(ids, trackChanges: false);
@ -63,9 +66,9 @@ namespace Ultimate.Presentation.Controllers
[HttpPost("collection")] [HttpPost("collection")]
public IActionResult CreateCompanyCollection([FromBody] IEnumerable<CompanyCreateDto> collection) public IActionResult CreateCompanyCollection([FromBody] IEnumerable<CompanyCreateDto> collection)
{ {
var result = _service.CompanyService.CreateCompanyCollection(collection); var (companies, ids) = _service.CompanyService.CreateCompanyCollection(collection);
return CreatedAtRoute("CompanyCollection", new { result.ids }, result.companies); return CreatedAtRoute("CompanyCollection", new { ids }, companies);
} }
[HttpDelete("{companyId:guid}", Name = "DeleteCompany")] [HttpDelete("{companyId:guid}", Name = "DeleteCompany")]
@ -82,7 +85,9 @@ namespace Ultimate.Presentation.Controllers
{ {
return BadRequest("Company update data is null"); return BadRequest("Company update data is null");
} }
_service.CompanyService.UpdateCompany(companyId, company, trackChanges: true); _service.CompanyService.UpdateCompany(companyId, company, trackChanges: true);
return NoContent(); return NoContent();
} }
} }
}

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>