public ActionResult Deposit(TransactionModel model) { _logger.LogInformation("Deposite method called with request parameter : " + model); ResponseModel response = new ResponseModel(); try { if (ModelState.IsValid) { _logger.LogInformation("check passed model is valid or not"); response = _walletService.Deposit(model); } else { _logger.LogError("Invalid model"); response.StatusCode = (int)HttpStatusCode.BadRequest; response.Message = UtilityResource.ErrorMessage; response.Description = UtilityResource.InvalidData; response.Data = null; } } catch (Exception ex) { _logger.LogError("Error in deposite method, error message " + ex.Message); response.StatusCode = (int)HttpStatusCode.InternalServerError; response.Message = UtilityResource.ErrorMessage; response.Description = ex.Message; response.Data = null; } return(Ok(response)); }
/// <summary> /// deposit amount in wallet (Pragati jain 09-01-2020) /// </summary> /// <param name="model"></param> /// <returns></returns> public string Deposit(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.Deposit).Replace("{RequestParameter}", requestParameter)); if (string.IsNullOrEmpty(model.TransactionAmount.ToString()) || model.TransactionAmount == 0 || model.TransactionAmount < 1) { 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.Deposit(model); log.Append(UtilityResource.ExecutedSuccessfully.Replace("{MethodName}", UtilityResource.Deposit)); } catch (Exception ex) { log.Append(UtilityResource.ErrorInMethod.Replace("{MethodName}", UtilityResource.Deposit).Replace("{ErrorMessage}", ex.Message)); LogManagers.LogManagers.WriteErrorLog(ex); response = ex.Message; } finally { LogManagers.LogManagers.WriteTraceLog(log); } return response; }