public async Task <CostControlBusinessEntity.DataImport> RemoveAsync(object id, CancellationToken cancellationToken = default(CancellationToken)) { if (id == null) { return(null); } CostControlEntity.DataImport entity = await Repository.GetByIdAsync(id, null, cancellationToken); if (entity != null) { CostControlBusinessEntity.DataImport result = DataImportIMapper.Map <CostControlEntity.DataImport, CostControlBusinessEntity.DataImport>(Repository.Remove(id)); await _unitOfWork.CommitAsync(cancellationToken); return(result); } return(null); }
public CostControlBusinessEntity.DataImport Update(CostControlBusinessEntity.DataImport entity) { if (entity == null) { return(null); } try { CostControlEntity.DataImport DataImport = DataImportIMapper.Map <CostControlBusinessEntity.DataImport, CostControlEntity.DataImport>(entity); CostControlBusinessEntity.DataImport result = DataImportIMapper.Map <CostControlEntity.DataImport, CostControlBusinessEntity.DataImport>(Repository.Update(DataImport)); _unitOfWork.Commit(); return(result); } catch (Exception ex) { throw ex; } }
public async Task <CostControlBusinessEntity.DataImport> AddAsync(CostControlBusinessEntity.DataImport entity, CancellationToken cancellationToken = default(CancellationToken)) { if (entity == null) { return(null); } try { CostControlEntity.DataImport DataImport = DataImportIMapper.Map <CostControlBusinessEntity.DataImport, CostControlEntity.DataImport>(entity); CostControlBusinessEntity.DataImport result = DataImportIMapper.Map <CostControlEntity.DataImport, CostControlBusinessEntity.DataImport>(Repository.Add(DataImport)); await _unitOfWork.CommitAsync(cancellationToken); return(result); } catch (Exception ex) { throw ex; } }