forked from ddrilling/AsbCloudServer
MeasureService.GetHisoryAsync(..) uses idCategory arg
This commit is contained in:
parent
ee01ab30db
commit
819bc82227
@ -9,7 +9,7 @@ namespace AsbCloudApp.Services
|
|||||||
{
|
{
|
||||||
Task<Dictionary<int, string>> GetCategoriesAsync(CancellationToken token);
|
Task<Dictionary<int, string>> GetCategoriesAsync(CancellationToken token);
|
||||||
Task<MeasureDto> GetLastAsync(int idWell, int idCategory, CancellationToken token);
|
Task<MeasureDto> GetLastAsync(int idWell, int idCategory, CancellationToken token);
|
||||||
Task<IEnumerable<MeasureDto>> GetHisoryAsync(int idWell, CancellationToken token);
|
Task<IEnumerable<MeasureDto>> GetHisoryAsync(int idWell, int idCategory, CancellationToken token);
|
||||||
Task<int> InsertAsync(int idWell, MeasureDto data, CancellationToken token);
|
Task<int> InsertAsync(int idWell, MeasureDto data, CancellationToken token);
|
||||||
Task<int> UpdateAsync(int idWell, MeasureDto data, CancellationToken token);
|
Task<int> UpdateAsync(int idWell, MeasureDto data, CancellationToken token);
|
||||||
Task<int> MarkAsDeleteAsync(int idWell, int idData, CancellationToken token);
|
Task<int> MarkAsDeleteAsync(int idWell, int idData, CancellationToken token);
|
||||||
|
@ -47,10 +47,10 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
return dtos;
|
return dtos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<MeasureDto>> GetHisoryAsync(int idWell, CancellationToken token)
|
public async Task<IEnumerable<MeasureDto>> GetHisoryAsync(int idWell, int idCategory, CancellationToken token)
|
||||||
{
|
{
|
||||||
var query = db.Measures.Include(m => m.Category)
|
var query = db.Measures.Include(m => m.Category)
|
||||||
.Where(m => m.IdWell == idWell && !m.IsDeleted);
|
.Where(m => m.IdWell == idWell && !m.IsDeleted && m.IdCategory == idCategory);
|
||||||
|
|
||||||
var entities = await query
|
var entities = await query
|
||||||
.OrderBy(m => m.Timestamp)
|
.OrderBy(m => m.Timestamp)
|
||||||
|
@ -50,7 +50,7 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
var result = await measureService.GetHisoryAsync(idWell, token).ConfigureAwait(false);
|
var result = await measureService.GetHisoryAsync(idWell, idCategory, token).ConfigureAwait(false);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user