public ActionResult Transfer() { TransferRequest request = new TransferRequest(); acctRepository acctRepo = new acctRepository(); TransferResponse response = new TransferResponse(); using (Stream stream = Request.InputStream) { using (StreamReader reader = new StreamReader(stream)) { request = JsonConvert.DeserializeObject <TransferRequest>(reader.ReadToEnd()); } } var repoResponse = new object(); if (request.Type == 1) { repoResponse = acctRepo.Bet(request); } if (request.Type == 4) { repoResponse = acctRepo.Payout(request); } if (request.Type == 2) { repoResponse = acctRepo.Cancel(request); } if ((int)repoResponse == 50100) { response.Msg = "Account Not Found"; response.Code = 50100; return(Json(response)); } if ((int)repoResponse == 5) { response.Msg = "TransferId can not be the same"; response.Code = 5; return(Json(response)); } if ((int)repoResponse == 100) { response.Msg = "Not enough money in balance"; response.Code = 100; return(Json(response)); } if ((int)repoResponse == 80) { response.Msg = "This transferid has already been canceled"; response.Code = 80; return(Json(response)); } if ((int)repoResponse == 50) { response.Msg = "TransferId does not Exists"; response.Code = 50; return(Json(response)); } if ((int)repoResponse == 90) { response.Msg = "amount does not equal old amount"; response.Code = 90; return(Json(response)); } if ((int)repoResponse == 33) { response.Msg = "Currency must match old transfer Currency"; response.Code = 33; return(Json(response)); } if ((int)repoResponse == 45) { response.Msg = "type 4 can not be canceled nor changed at all"; response.Code = 45; return(Json(response)); } if ((int)repoResponse == 22) { response.Msg = "Currency does not match"; response.Code = 22; return(Json(response)); } response.TransferId = request.TransferId; response.MerchantTxId = request.MerchantTxId; response.AcctId = request.AcctId; response.Balance = request.CurrentBalance; response.MerchantCode = request.MerchantCode; response.Code = 0; response.Msg = "Success"; response.SerialNo = request.SerialNo; return(Json(response)); }