Example #1
0
        public async Task <CostControlBusinessEntity.SaleCostPoint> RemoveAsync(object id,
                                                                                CancellationToken cancellationToken = default(CancellationToken))
        {
            if (id == null)
            {
                return(null);
            }

            CostControlEntity.SaleCostPoint entity = await Repository.GetByIdAsync(id, null, cancellationToken);

            if (entity != null)
            {
                CostControlBusinessEntity.SaleCostPoint result = SaleCostPointIMapper.Map <CostControlEntity.SaleCostPoint, CostControlBusinessEntity.SaleCostPoint>(Repository.Remove(id));
                await _unitOfWork.CommitAsync(cancellationToken);

                return(result);
            }

            return(null);
        }
Example #2
0
        public CostControlBusinessEntity.SaleCostPoint Update(CostControlBusinessEntity.SaleCostPoint entity)
        {
            if (entity == null)
            {
                return(null);
            }

            try
            {
                CostControlEntity.SaleCostPoint SaleCostPoint = SaleCostPointIMapper.Map <CostControlBusinessEntity.SaleCostPoint, CostControlEntity.SaleCostPoint>(entity);

                CostControlBusinessEntity.SaleCostPoint result = SaleCostPointIMapper.Map <CostControlEntity.SaleCostPoint, CostControlBusinessEntity.SaleCostPoint>(Repository.Update(SaleCostPoint));
                _unitOfWork.Commit();

                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
        public async Task <CostControlBusinessEntity.SaleCostPoint> AddAsync(CostControlBusinessEntity.SaleCostPoint entity,
                                                                             CancellationToken cancellationToken = default(CancellationToken))
        {
            if (entity == null)
            {
                return(null);
            }

            try
            {
                CostControlEntity.SaleCostPoint SaleCostPoint = SaleCostPointIMapper.Map <CostControlBusinessEntity.SaleCostPoint, CostControlEntity.SaleCostPoint>(entity);

                CostControlBusinessEntity.SaleCostPoint result = SaleCostPointIMapper.Map <CostControlEntity.SaleCostPoint, CostControlBusinessEntity.SaleCostPoint>(Repository.Add(SaleCostPoint));
                await _unitOfWork.CommitAsync(cancellationToken);

                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }