public async Task CreatePharmacyInventory_OnlyIf_Item_And_Pharmacy_Exists_Success()
        {
            var request = dataSetTest.GetFakeCreatePharmacyInventoryRequest_OnlyIf_Item_And_Pharmacy_Exists_Success();
            var result  = await _domainService.CreatePharmacyInventory(request);

            Assert.IsTrue(result.Id > 0);
        }
示例#2
0
        public async Task <CreatePharmacyInventoryResponse> Post([FromBody] CreatePharmacyInventoryRequest request)
        {
            CreatePharmacyInventoryResponse createPharmacyInventoryResponse = null;

            try
            {
                if (request.QuantityOnHand <= 0)
                {
                    throw new Exception($"QuantityOnHand must be non zero.");
                }

                var item = await _domainService.CreatePharmacyInventory(request);

                if (item != null)
                {
                    createPharmacyInventoryResponse = _mapper.Map <CreatePharmacyInventoryResponse>(item);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(createPharmacyInventoryResponse);
        }