Пример #1
0
        public async Task <ArticleInventoryResponse> DeleteArticleInventoryAsync(DeleteArticleInventoryRequest request)
        {
            if (request?.Id == null)
            {
                throw new ArgumentNullException();
            }

            ArticleInventory result = await _articleInventoryRespository.GetAsync(request.Id);

            if (result == null)
            {
                throw new ArgumentException($"Entity with {request.Id} is not present");
            }

            result.IsInactive = true;

            _articleInventoryRespository.Update(result);
            int modifiedRecords = await _articleInventoryRespository.UnitOfWork.SaveChangesAsync();

            _logger.LogInformation(Logging.Events.Delete, Messages.NumberOfRecordAffected_modifiedRecords, modifiedRecords);

            return(_articleInventoryMapper.Map(result));
        }