public IHttpActionResult Get() { MakeChargeService chargeTransactionService = CreateMakeChargeServiceForGuid(); var chargeTransactions = chargeTransactionService.PlayerGetChargeTransactions(); return(Ok(chargeTransactions)); }
private MakeChargeService CreateMakeChargeServiceForGuid() { var userId = Guid.Parse(User.Identity.GetUserId()); var makeChargeService = new MakeChargeService(userId); return(makeChargeService); }
public IHttpActionResult Charge(RevisedChargeModel charge) { var newCharge = MakeChargeService.Charge(charge.CardNumber, charge.Month, charge.Year, charge.Cvc, charge.Zip, charge.Value); if (newCharge) { MakeChargeService chargeService = CreateMakeChargeServiceForGuid(); // adds entry to ChargeForChips table AND BankTransaction Table AND Player table's PlayerBalance chargeService.CreateChargeforChips(charge); return(Ok($"charge made: $ {charge.Value / 100} charged to your card, and ${charge.Value / 100} added to your player account")); // put in message } else { return(InternalServerError()); // put in message } }