Example #1
0
        public async Task <ActionResult <BinItemDto> > CreateBinItem(CreateBinItemDto createBinItemDto)
        {
            var bin = await _binRepository.GetBinByCode(createBinItemDto.BinCode);

            var item = await _itemRepository.GetItemByNumber(createBinItemDto.ItemNumber);

            var lot = await _shippingRepository.GetShippingLotByNumber(createBinItemDto.LotNumber);

            var binItem = new BinItem
            {
                Quantity    = createBinItemDto.Quantity,
                Bin         = bin,
                Item        = item,
                ShippingLot = lot,
            };

            _binItemRepository.AddBinItem(binItem);

            if (await _binItemRepository.SaveAllAsync())
            {
                return(Ok(_mapper.Map <BinItemDto>(binItem)));
            }

            return(BadRequest("Failed to add item."));
        }
        public async Task <ActionResult <ShippingLot> > GetLotByNumber(string number)
        {
            var lot = await _shippingRepository.GetShippingLotByNumber(number);

            return(Ok(_mapper.Map <ShippingLot>(lot)));
        }