[HttpGet("{storageListId}", Name = nameof(GetStorageList))]    //P6
        public async Task <ActionResult <StorageList> > GetStorageList(Guid storageListId)
        {
            var storageList = await _storageListRepository.GetStorageListAsync(storageListId);

            if (storageList == null)
            {
                return(NotFound());
            }
            return(Ok(storageList));
        }
Esempio n. 2
0
        public async Task <IActionResult> DeleteStorageList(Guid storageListId)
        {
            var entity = await _storageListRepository.GetStorageListAsync(storageListId);

            if (entity == null)
            {
                return(NotFound());
            }
            //删除入库单的时候,库存应对应减少
            foreach (var storageProduct in entity.StorageProducts)
            {
                _stockRepository.StockOut(_mapper.Map <OutboundProductAddOrUpdateDto>(storageProduct));
            }
            _storageListRepository.DeleteStorageList(entity);
            _storageListRepository.SaveAsync();
            return(NoContent());
        }