public async Task <IActionResult> Withdraw(WithdrawViewModel model) { TransactionStatusViewModel transactionStatus = new TransactionStatusViewModel(); try { var response = await _transactionProvider.Withdraw(model); if (response.StatusCode == System.Net.HttpStatusCode.OK) { var jsoncontent = await response.Content.ReadAsStringAsync(); transactionStatus = JsonConvert.DeserializeObject <TransactionStatusViewModel>(jsoncontent); return(View("TransactionStatus", transactionStatus)); } else if (response.StatusCode == System.Net.HttpStatusCode.NotFound) { ModelState.AddModelError("", "Having server issue while adding record"); return(View(model)); } else if (response.StatusCode == System.Net.HttpStatusCode.InternalServerError) { ViewBag.Message = "Internal Server Error! Please try again later"; return(View(model)); } } catch (Exception ex) { _logger.Error("Exceptions occured due to " + ex.Message); } ModelState.AddModelError("", "Having some unexpected error while processing transaction"); return(View(model)); }