forked from ddrilling/AsbCloudServer
WellSectionController params order
This commit is contained in:
parent
f0f9d1df73
commit
95a3a0d207
@ -10,8 +10,8 @@ namespace AsbCloudApp.Services
|
|||||||
Task<PaginationContainer<WellSectionDto>> GetAllByWellIdAsync(int idWell, int skip = 0, int take = 32, CancellationToken token = default);
|
Task<PaginationContainer<WellSectionDto>> GetAllByWellIdAsync(int idWell, int skip = 0, int take = 32, CancellationToken token = default);
|
||||||
Task<WellSectionDto> GetAsync(int id, CancellationToken token = default);
|
Task<WellSectionDto> GetAsync(int id, CancellationToken token = default);
|
||||||
Task<WellSectionDto> InsertAsync(WellSectionDto newItem, int idWell, CancellationToken token = default);
|
Task<WellSectionDto> InsertAsync(WellSectionDto newItem, int idWell, CancellationToken token = default);
|
||||||
Task<IEnumerable<WellSectionDto>> InsertRangeAsync(IEnumerable<WellSectionDto> newItems, int idWell, CancellationToken token = default);
|
Task<IEnumerable<WellSectionDto>> InsertRangeAsync(int idWell, IEnumerable<WellSectionDto> newItems, CancellationToken token = default);
|
||||||
Task<WellSectionDto> UpdateAsync(WellSectionDto item, int idSection, int idWell, CancellationToken token = default);
|
Task<WellSectionDto> UpdateAsync(int idWell, int idSection, WellSectionDto item, CancellationToken token = default);
|
||||||
Task<int> DeleteAsync(IEnumerable<int> ids, CancellationToken token = default);
|
Task<int> DeleteAsync(IEnumerable<int> ids, CancellationToken token = default);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<WellSectionDto>> InsertRangeAsync(IEnumerable<WellSectionDto> items, int idWell, CancellationToken token = default)
|
public async Task<IEnumerable<WellSectionDto>> InsertRangeAsync(int idWell, IEnumerable<WellSectionDto> items, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var dbEntities = new Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<WellSection>[items.Count()];
|
var dbEntities = new Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<WellSection>[items.Count()];
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
return dtos;
|
return dtos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<WellSectionDto> UpdateAsync(WellSectionDto item, int idSection, int idWell, CancellationToken token = default)
|
public async Task<WellSectionDto> UpdateAsync(int idWell, int idSection, WellSectionDto item, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var sectionType = await GetWellSectionTypeFromCacheAndAssert(item.SectionType);
|
var sectionType = await GetWellSectionTypeFromCacheAndAssert(item.SectionType);
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("{idSection}")]
|
[Route("{idSection}")]
|
||||||
public async Task<IActionResult> GetAsync(int idSection, int idWell,
|
public async Task<IActionResult> GetAsync(int idWell, int idSection,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
if (!await CanUserAccessToWellAsync(idWell, token))
|
if (!await CanUserAccessToWellAsync(idWell, token))
|
||||||
@ -52,27 +52,27 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
if (!await CanUserAccessToWellAsync(idWell, token))
|
if (!await CanUserAccessToWellAsync(idWell, token))
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
var result = await sectionsService.InsertRangeAsync(values, idWell, token).ConfigureAwait(false);
|
var result = await sectionsService.InsertRangeAsync(idWell, values, token).ConfigureAwait(false);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{idSection}")]
|
||||||
public async Task<IActionResult> PutAsync(int id, int idWell, [FromBody] WellSectionDto value, CancellationToken token = default)
|
public async Task<IActionResult> UpdateAsync(int idWell, int idSection, [FromBody] WellSectionDto value, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
if (!await CanUserAccessToWellAsync(idWell, token))
|
if (!await CanUserAccessToWellAsync(idWell, token))
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
var result = await sectionsService.UpdateAsync(value, id, idWell, token).ConfigureAwait(false);
|
var result = await sectionsService.UpdateAsync(idWell, idSection, value, token).ConfigureAwait(false);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{idSection}")]
|
||||||
public async Task<IActionResult> DeleteAsync(int id, int idWell, CancellationToken token = default)
|
public async Task<IActionResult> DeleteAsync(int idWell, int idSection, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
if (!await CanUserAccessToWellAsync(idWell, token))
|
if (!await CanUserAccessToWellAsync(idWell, token))
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
var result = await sectionsService.DeleteAsync(new int[] { id }, token).ConfigureAwait(false);
|
var result = await sectionsService.DeleteAsync(new int[] { idSection }, token).ConfigureAwait(false);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user