public async Task <IActionResult> Index(RuleViewModel model) { if (ModelState.IsValid) { await ruleRepository.AddRules(model.Rules); await monthlyAllowanceRuleRepository.AddMonthlyAllowanceRules(model.Allowances); TempData["StatusMessage"] = "Changes have been saved successfully."; } else { TempData["StatusMessage"] = "Error: Some fields are invalid!"; } return(View(model)); }