2021-04-02 17:28:07 +05:00
|
|
|
|
using AsbCloudApp.Data;
|
|
|
|
|
using AsbCloudApp.Services;
|
|
|
|
|
using AsbCloudDb.Model;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace AsbCloudInfrastructure.Services
|
|
|
|
|
{
|
|
|
|
|
public class WellService : IWellService
|
|
|
|
|
{
|
|
|
|
|
private readonly IAsbCloudDbContext db;
|
|
|
|
|
|
2021-04-23 10:21:25 +05:00
|
|
|
|
public WellService(IAsbCloudDbContext db)
|
2021-04-02 17:28:07 +05:00
|
|
|
|
{
|
|
|
|
|
this.db = db;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IEnumerable<WellDto> GetWellsByCustomer(int idCustomer)
|
|
|
|
|
{
|
|
|
|
|
var wells = db.GetWellsByCustomer(idCustomer).ToList();
|
|
|
|
|
return wells.Select(w => From(w));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private WellDto From(Well well)
|
|
|
|
|
{
|
|
|
|
|
var wellDto = new WellDto
|
|
|
|
|
{
|
|
|
|
|
Id = well.Id,
|
|
|
|
|
Caption = well.Caption,
|
|
|
|
|
Cluster = well.Cluster.Caption,
|
|
|
|
|
Deposit = well.Cluster.Deposit.Caption,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return wellDto;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|