using AutoMapper;
|
using System.Collections.Generic;
|
using Yw;
|
|
namespace HStation.BLL
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public class AssetsCompressorMainAndPartMapping
|
{
|
private readonly HStation.CAL.IAssetsCompressorMainAndPartMapping _cal = CALCreateHelper.CreateCAL<HStation.CAL.IAssetsCompressorMainAndPartMapping>();
|
|
#region Query
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<List<Vmo.AssetsCompressorMainAndPartMappingVmo>> GetAll()
|
{
|
var DtoList = await _cal.GetAll();
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Dto.Assets.AssetsCompressorMainAndPartMapDto, Vmo.AssetsCompressorMainAndPartMappingVmo>()
|
).CreateMapper();
|
var vmoList = mapper.Map<List<Dto.Assets.AssetsCompressorMainAndPartMapDto>, List<Vmo.AssetsCompressorMainAndPartMappingVmo>>(DtoList);
|
return vmoList;
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<Vmo.AssetsCompressorMainAndPartMappingVmo> GetByID(long ID)
|
{
|
var Dto = await _cal.GetByID(ID);
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Dto.Assets.AssetsCompressorMainAndPartMapDto, Vmo.AssetsCompressorMainAndPartMappingVmo>()
|
).CreateMapper();
|
var vmo = mapper.Map<Dto.Assets.AssetsCompressorMainAndPartMapDto, Vmo.AssetsCompressorMainAndPartMappingVmo>(Dto);
|
|
return vmo;
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<List<Vmo.AssetsCompressorMainAndPartMappingVmo>> GetByIds(List<long> Ids)
|
{
|
var DtoList = await _cal.GetByIds(Ids);
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Dto.Assets.AssetsCompressorMainAndPartMapDto, Vmo.AssetsCompressorMainAndPartMappingVmo>()
|
).CreateMapper();
|
var vmoList = mapper.Map<List<Dto.Assets.AssetsCompressorMainAndPartMapDto>, List<Vmo.AssetsCompressorMainAndPartMappingVmo>>(DtoList);
|
|
return vmoList;
|
}
|
|
#endregion Query
|
|
#region Insert
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<long> Insert(Vmo.AssetsCompressorMainAndPartMappingVmo model)
|
{
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.AssetsCompressorMainAndPartMappingVmo, AddAssetsCompressorMainAndPartMapInput>()
|
).CreateMapper();
|
var vmo = mapper.Map<Vmo.AssetsCompressorMainAndPartMappingVmo, AddAssetsCompressorMainAndPartMapInput>(model);
|
|
return await _cal.Insert(vmo);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> Inserts(List<Vmo.AssetsCompressorMainAndPartMappingVmo> list)
|
{
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.AssetsCompressorMainAndPartMappingVmo, AddAssetsCompressorMainAndPartMapInput>()
|
).CreateMapper();
|
var vmoList = mapper.Map<List<Vmo.AssetsCompressorMainAndPartMappingVmo>, List<AddAssetsCompressorMainAndPartMapInput>>(list);
|
|
return await _cal.Inserts(vmoList);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> BulkInserts(List<Vmo.AssetsCompressorMainAndPartMappingVmo> list)
|
{
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.AssetsCompressorMainAndPartMappingVmo, AddAssetsCompressorMainAndPartMapInput>()
|
).CreateMapper();
|
var vmoList = mapper.Map<List<Vmo.AssetsCompressorMainAndPartMappingVmo>, List<AddAssetsCompressorMainAndPartMapInput>>(list);
|
return await _cal.BulkInserts(vmoList);
|
}
|
|
#endregion Insert
|
|
#region Update
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> Update(Vmo.AssetsCompressorMainAndPartMappingVmo model)
|
{
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.AssetsCompressorMainAndPartMappingVmo, UpdateAssetsCompressorMainAndPartMapInput>()
|
).CreateMapper();
|
var vmo = mapper.Map<Vmo.AssetsCompressorMainAndPartMappingVmo, UpdateAssetsCompressorMainAndPartMapInput>(model);
|
return await _cal.Update(vmo);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> Updates(List<Vmo.AssetsCompressorMainAndPartMappingVmo> list)
|
{
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.AssetsCompressorMainAndPartMappingVmo, UpdateAssetsCompressorMainAndPartMapInput>()
|
).CreateMapper();
|
var vmoList = mapper.Map<List<Vmo.AssetsCompressorMainAndPartMappingVmo>, List<UpdateAssetsCompressorMainAndPartMapInput>>(list);
|
|
return await _cal.Updates(vmoList);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> BulkUpdates(List<Vmo.AssetsCompressorMainAndPartMappingVmo> list)
|
{
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.AssetsCompressorMainAndPartMappingVmo, UpdateAssetsCompressorMainAndPartMapInput>()
|
).CreateMapper();
|
var vmoList = mapper.Map<List<Vmo.AssetsCompressorMainAndPartMappingVmo>, List<UpdateAssetsCompressorMainAndPartMapInput>>(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
|
}
|
}
|