Beispiel #1
0
        public bool Delete(int id)
        {
            Storage storage = Find(id);

            if (storage == null)
            {
                return(false);
            }

            List <StorageRegion> storageRegions = _storageRegionService.GetAll(c => c.StorageId == id);

            foreach (var storageRegion in storageRegions)
            {
                _storageRegionService.Delete(storageRegion);
            }

            List <GoodsStorage> goodsStorages = _goodsStorageService.GetAll(c => c.StorageId == id);

            foreach (var goodsStorage in goodsStorages)
            {
                _goodsStorageService.Delete(goodsStorage);
            }

            List <GoodsLeave> goodsLeaves = _leaveRepository.Select(c => c.StorageId == id);

            foreach (var goodsLeaf in goodsLeaves)
            {
                _leaveRepository.Delete(goodsLeaf);
                _unitOfWork.Commit();
            }

            _repository.Delete(storage);
            return(_unitOfWork.Commit() > 0);
        }
Beispiel #2
0
 public IAjaxResult DeleteStorageRegion(int id)
 {
     if (_storageRegionService.Delete(id))
     {
         return(Success("删除成功"));
     }
     else
     {
         return(Error("删除失败"));
     }
 }
Beispiel #3
0
        public bool Delete(int id)
        {
            if (id <= 0)
            {
                return(false);
            }

            List <StorageRegion> storageRegions = _storageRegionService.GetAll(c => c.RegionId == id);

            foreach (var storageRegion in storageRegions)
            {
                _storageRegionService.Delete(storageRegion);
            }

            _repository.Delete(id);
            return(_unitOfWork.Commit() > 0);
        }