public string BonusRefund(float amount, string endUserIdentifier, string billingText, string TransactionID, string externalData1, string externalData2, string receivedTime, string serviceIdentifier, string NAI, string currency, string account) { try { using (var context = new SOAEntities()) { var customer = context.Customers.FirstOrDefault(x => x.msisdn == endUserIdentifier); var customerBalance = customer.BonusBalance; if ((amount + customerBalance) < 2000) { customer.BonusBalance = customerBalance + amount; context.SaveChanges(); return("resp>0</resp>respMessage>Customer refunded Successfuly</respMessage>"); } else { return("resp>-1</resp>respMessage>Customer has exceeded the balance limit</respMessage>"); } } } catch (Exception ex) { return($"resp>-1</resp>respMessage>{ex.Message}</respMessage>"); } }
public CustomerCharge GetCharges(string msisdn) { using (var context = new SOAEntities()) { var charge = context.CustomerCharges.FirstOrDefault(x => x.msisdn == msisdn); return(charge); } }