public IHttpActionResult MakeDeposit([FromBody] MakeDepositParams makeDepositParams) { if (log.IsDebugEnabled) { log.Debug(string.Format("Make Deposit call: Currency = {0}", makeDepositParams.Currency)); } try { // Get api key from header var headers = Request.Headers; string apikey = ""; IEnumerable <string> headerParams; if (headers.TryGetValues("Auth", out headerParams)) { string[] auth = headerParams.ToList()[0].Split(','); apikey = auth[0]; } if (log.IsDebugEnabled) { log.Debug(string.Format("Make Deposit Call: ApiKey = {0}", apikey)); } if (!string.IsNullOrEmpty(apikey) && !string.IsNullOrEmpty(makeDepositParams.Currency)) { int accountId = _apiKeyInfoAccess.GetUserIdFromApiKey(apikey); return(Ok(_depositApplicationService.MakeDeposit(new MakeDepositCommand( accountId, makeDepositParams.Currency, makeDepositParams.Amount, makeDepositParams.IsCryptoCurrency)))); } return(BadRequest("Currency is not provided or API key not found with request")); } catch (InvalidOperationException exception) { if (log.IsErrorEnabled) { log.Error("Make Deposit Exception ", exception); } return(BadRequest(exception.Message)); } catch (NullReferenceException exception) { if (log.IsErrorEnabled) { log.Error("Make Deposit Exception ", exception); } return(BadRequest(exception.Message)); } catch (InstanceNotFoundException exception) { if (log.IsErrorEnabled) { log.Error("Make Deposit Exception ", exception); } return(BadRequest(exception.Message)); } catch (Exception exception) { if (log.IsErrorEnabled) { log.Error(string.Format("Make Deposit Call Error: {0}", exception)); } return(InternalServerError()); } }