コード例 #1
0
        public TextbookView GetById(string textbookId)
        {
            var id   = textbookId.ConvertToGuid();
            var book = _bookRepo.First(t => t.ID == id);

            return(_adapter.Adapt <TextbookView>(book));
        }
コード例 #2
0
        public InventoryView GetInventory(string storageId, string textbookId)
        {
            var storId = storageId.ConvertToGuid();
            var textId = textbookId.ConvertToGuid();

            var inventory = _inventoryRepo.First(t =>
                                                 t.Storage_Id == storId &&
                                                 t.Textbook_Id == textId
                                                 );

            //未入库
            if (inventory == null)
            {
                var book = _textbookRepo.First(t => t.ID == textId);

                var inve = _adapter.Adapt <InventoryView>(book);
                inve.StorageId = storageId;

                return(inve);
            }
            else
            {
                return(_adapter.Adapt <InventoryView>(inventory));
            }
        }