public async Task <IActionResult> Index(string AnnualSalary, string postalCode, TaxCalculatorViewModel m) { var model = new TaxCalculatorViewModel(); var user = await _userManager.FindByNameAsync(User.Identity.Name); model.calculations = await _taxRepository.GetCalculations(user.Id); if (m.Calculation != null) { var amoutOwed = _taxRepository.TaxCalculation(Convert.ToDouble(m.Calculation.Salary), m.Calculation.PostalCode); var calc = new Calculation(); calc.PostalCode = m.Calculation.PostalCode; calc.Salary = m.Calculation.Salary; calc.TotalOwedIncomeTax = amoutOwed; calc.InsertedUserId = user.Id; await _taxRepository.AddCalculation(calc); model.calculations.Add(calc); } return(View(model)); }