예제 #1
0
        public IActionResult PurchaseItem([FromBody] PurchaseItemRequest purchaseItemRequest)
        {
            var result = _vendingMachineService.PurchaseItem(purchaseItemRequest);

            if (result.IsSuccessful)
            {
                if (result.Coins != null && result.Coins.Count != 0)
                {
                    return(Ok(result.Coins));
                }
                else
                {
                    return(NoContent());
                }
            }
            else
            {
                return(BadRequest(result));
            }
        }