public async Task <IActionResult> PaybillSave(int from_account, decimal amount, string schedule_date, int Period) { _logger.LogInformation("First parameter. {0}", from_account); _logger.LogInformation("Second parameter. {0}", amount); _logger.LogInformation("Third parameter. {0}", Period); Account account = await _context.Accounts.FindAsync(from_account); if (amount <= 0) { ModelState.AddModelError(nameof(amount), "Amount must be positive."); } if (amount.HasMoreThanTwoDecimalPlaces()) { ModelState.AddModelError(nameof(amount), "Amount cannot have more than 2 decimal places."); } if (!ModelState.IsValid) { ViewBag.Amount = amount; return(RedirectToAction(nameof(Paybill))); } try { var BankObj = new BankRepository(_context); var postId = await BankObj.BillPay(from_account, amount, schedule_date, Period); if (postId > 0) { return(RedirectToAction(nameof(Index))); } else { ViewBag.ErrorTitle = "PayBill Save Page Post"; ViewBag.ErrorMessage = "404: Error in PayBill Form, plaese try again..."; return(View("Error")); } } catch (Exception) { ViewBag.ErrorTitle = "PayBill Save Page Post"; ViewBag.ErrorMessage = "404: Error in PayBill Form, plaese try again..."; return(View("Error")); } }