public async Task <IActionResult> CreatePlannedPurchase(PlannedPurchase newPurchase)
        {
            if (newPurchase == null)
            {
                return(BadRequest("PlannedPurchase was null"));
            }

            await plannedPurchaseRepository.CreatePlannedPurchaseAsync(dtoMapper.Map <PlannedPurchaseDTO>(newPurchase));

            return(CreatedAtRoute(nameof(GetSpecificPlannedPurchase), new { listId = newPurchase.PlannedPurchase_Id }, newPurchase));
        }
Example #2
0
        public void CreatePlannedPurchaseAsync_NullParameterThrows()
        {
            repository = new PlannedPurchaseRepository(context);

            Assert.ThrowsAsync <ArgumentNullException>(() => repository.CreatePlannedPurchaseAsync(null));
        }