public async Task <IActionResult> TopUpTransportCard([FromBody] TopUpCardViewModel tuc) { if (tuc.Amount < 100 || tuc.Amount > 10000) { return(BadRequest(new { response_message = "Cannot Proceed. You can only top up between the amount of 100 to 10000 pesos.", isError = true })); } TransportCard transportCard = await _cardService.GetTransportCardById(tuc.TransportCardId); transportCard.Load += tuc.Amount; bool response = await _cardService.TopUpAccount(transportCard); if (response) { tuc.Balance = transportCard.Load; tuc.Change = tuc.Cash - tuc.Amount; return(Ok(new { response_message = "Successfully Credited to account.", isError = false, tuc })); } else { return(BadRequest(new { response_message = "Internal Server Error. Please contact your local IT.", isError = true })); } }
public TopUpCardView(TopUpCardViewModel info) { InitializeComponent(); BindingContext = info; }