public ActionResult Withdrawal(TransactionModel model) { ResponseModel response = new ResponseModel(); try { if (ModelState.IsValid) { response = _walletService.Withdrawal(model); } else { response.StatusCode = (int)HttpStatusCode.BadRequest; response.Message = UtilityResource.ErrorMessage; response.Description = UtilityResource.InvalidData; response.Data = null; } } catch (Exception ex) { response.StatusCode = (int)HttpStatusCode.InternalServerError; response.Message = UtilityResource.ErrorMessage; response.Description = ex.Message; response.Data = null; } return(Ok(response)); }
/// <summary> /// withdrawal some amount frfom wallet (Pragati jain 09-01-2020) /// </summary> /// <param name="model"></param> /// <returns></returns> public string Withdrawal(TransactionModel model) { StringBuilder log = new StringBuilder(); string response = string.Empty; string requestParameter = "TransactionAmount = " + model.TransactionAmount + ", " + "PlayerId = " + model.PlayerId + ", " + "TransactionDescription = " + model.TransactionDescription + ", " + "TransactionCode = " + model.TransactionCode; log.Append(UtilityResource.LogStartMessage.Replace("{MethodName}", UtilityResource.Withdrawal).Replace("{RequestParameter}", requestParameter)); if (string.IsNullOrEmpty(model.TransactionAmount.ToString()) || model.TransactionAmount == 0) { log.Append(UtilityResource.TransactionAmountError); response = UtilityResource.TransactionAmountError; return response; } if (string.IsNullOrEmpty(model.PlayerId)) { log.Append(UtilityResource.PlayerIdError); response = UtilityResource.PlayerIdError; return response; } if (string.IsNullOrEmpty(model.TransactionDescription)) { model.TransactionDescription = string.Empty; } if (string.IsNullOrEmpty(model.TransactionCode)) { log.Append(UtilityResource.TransactionCodeError); response = UtilityResource.TransactionCodeError; return response; } try { response = _walletService.Withdrawal(model); log.Append(UtilityResource.ExecutedSuccessfully.Replace("{MethodName}", UtilityResource.Withdrawal)); } catch (Exception ex) { log.Append(UtilityResource.ErrorInMethod.Replace("{MethodName}", UtilityResource.Withdrawal).Replace("{ErrorMessage}", ex.Message)); LogManagers.LogManagers.WriteErrorLog(ex); response = ex.Message; } finally { LogManagers.LogManagers.WriteTraceLog(log); } return response; }