using AutoMapper;
|
using System.Collections.Generic;
|
using Yw;
|
|
namespace HStation.BLL
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public class AssetsPumpPropContent
|
{
|
private readonly HStation.CAL.IAssetsPumpPropContent _cal = CALCreateHelper.CreateCAL<HStation.CAL.IAssetsPumpPropContent>();
|
|
#region Query
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<List<Vmo.AssetsPumpPropContentVmo>> GetAll()
|
{
|
var DtoList = await _cal.GetAll();
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Dto.Assets.AssetsPumpPropContentDto, Vmo.AssetsPumpPropContentVmo>()
|
).CreateMapper();
|
var vmoList = mapper.Map<List<Dto.Assets.AssetsPumpPropContentDto>, List<Vmo.AssetsPumpPropContentVmo>>(DtoList);
|
|
return vmoList;
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<Vmo.AssetsPumpPropContentVmo> GetByID(long ID)
|
{
|
var Dto = await _cal.GetByID(ID);
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Dto.Assets.AssetsPumpPropContentDto, Vmo.AssetsPumpPropContentVmo>()
|
).CreateMapper();
|
var vmo = mapper.Map<Dto.Assets.AssetsPumpPropContentDto, Vmo.AssetsPumpPropContentVmo>(Dto);
|
|
return vmo;
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<List<Vmo.AssetsPumpPropContentVmo>> GetByIds(List<long> Ids)
|
{
|
var DtoList = await _cal.GetByIds(Ids);
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Dto.Assets.AssetsPumpPropContentDto, Vmo.AssetsPumpPropContentVmo>()
|
).CreateMapper();
|
var vmoList = mapper.Map<List<Dto.Assets.AssetsPumpPropContentDto>, List<Vmo.AssetsPumpPropContentVmo>>(DtoList);
|
return vmoList;
|
}
|
|
public async Task<List<Vmo.AssetsPumpPropContentVmo>> GetByPumpPartID(long pumpPartId)
|
{
|
var DtoList = await _cal.GetByPumpPartID(pumpPartId);
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Dto.Assets.AssetsPumpPropContentDto, Vmo.AssetsPumpPropContentVmo>()
|
).CreateMapper();
|
var vmoList = mapper.Map<List<Dto.Assets.AssetsPumpPropContentDto>, List<Vmo.AssetsPumpPropContentVmo>>(DtoList);
|
|
return vmoList;
|
}
|
|
#endregion Query
|
|
#region Insert
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<long> Insert(Vmo.AssetsPumpPropContentVmo model)
|
{
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.AssetsPumpPropContentVmo, AddAssetsPumpPropContentInput>()
|
).CreateMapper();
|
var vmo = mapper.Map<Vmo.AssetsPumpPropContentVmo, AddAssetsPumpPropContentInput>(model);
|
return await _cal.Insert(vmo);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> Inserts(List<Vmo.AssetsPumpPropContentVmo> list)
|
{
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.AssetsPumpPropContentVmo, AddAssetsPumpPropContentInput>()
|
).CreateMapper();
|
var vmoList = mapper.Map<List<Vmo.AssetsPumpPropContentVmo>, List<AddAssetsPumpPropContentInput>>(list);
|
|
return await _cal.Inserts(vmoList);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> BulkInserts(List<Vmo.AssetsPumpPropContentVmo> list)
|
{
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.AssetsPumpPropContentVmo, AddAssetsPumpPropContentInput>()
|
).CreateMapper();
|
var vmoList = mapper.Map<List<Vmo.AssetsPumpPropContentVmo>, List<AddAssetsPumpPropContentInput>>(list);
|
|
return await _cal.BulkInserts(vmoList);
|
}
|
|
#endregion Insert
|
|
#region Update
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> Update(Vmo.AssetsPumpPropContentVmo model)
|
{
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.AssetsPumpPropContentVmo, UpdateAssetsPumpPropContentInput>()
|
).CreateMapper();
|
var Vmo = mapper.Map<Vmo.AssetsPumpPropContentVmo, UpdateAssetsPumpPropContentInput>(model);
|
|
return await _cal.Update(Vmo);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> Updates(List<Vmo.AssetsPumpPropContentVmo> list)
|
{
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.AssetsPumpPropContentVmo, UpdateAssetsPumpPropContentInput>()
|
).CreateMapper();
|
var vmoList = mapper.Map<List<Vmo.AssetsPumpPropContentVmo>, List<UpdateAssetsPumpPropContentInput>>(list);
|
|
return await _cal.Updates(vmoList);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> BulkUpdates(List<Vmo.AssetsPumpPropContentVmo> list)
|
{
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.AssetsPumpPropContentVmo, UpdateAssetsPumpPropContentInput>()
|
).CreateMapper();
|
var vmoList = mapper.Map<List<Vmo.AssetsPumpPropContentVmo>, List<UpdateAssetsPumpPropContentInput>>(list);
|
|
return await _cal.BulkUpdates(vmoList);
|
}
|
|
#endregion Update
|
|
#region Delete
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> DeleteByID(long ID)
|
{
|
return await _cal.DeleteByID(ID);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> DeleteByIds(List<long> Ids)
|
{
|
return await _cal.DeleteByIds(Ids);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> DeleteAll()
|
{
|
return await _cal.DeleteAll();
|
}
|
|
#endregion Delete
|
}
|
}
|