public IActionResult ConsumePurchase( [FromBody] PurchaseForConsumptionDto purchaseToConsume) { if (purchaseToConsume == null) { return(BadRequest()); } if (!_purchaseRepository.Exists(purchaseToConsume.Id) || !_playerRepository.Exists(purchaseToConsume.PlayerId)) { return(NotFound()); } List <LootDto> rollResult = _purchaseRepository.ConsumePurchase(purchaseToConsume.PlayerId, purchaseToConsume.Id); if (rollResult != null) { if (!_purchaseRepository.Save()) { return(StatusCode(500, "A problem happened while handling your request")); } List <LootPurchaseResultDto> LootPurchaseResult = Mapper.Map <List <LootPurchaseResultDto> >(rollResult); return(Ok(LootPurchaseResult)); } return(StatusCode(501, "Purchase of Id " + purchaseToConsume.Id + " already consumed or isn't affiliated to specified")); }