public async Task <IActionResult> EditAll(PayratesViewModel model) { foreach (var payrate in model.Payrates) { _context.Update(payrate.Value); await _context.SaveChangesAsync(); } return(RedirectToAction("Index")); }
public async Task <IActionResult> EditAll() { // get the selected users data var model = new PayratesViewModel { Payrates = new Dictionary <int, Payrate>() }; // get roles and check if user has role foreach (var payrate in _context.Payrate.ToList()) { model.Payrates.Add(payrate.Id, payrate); } return(View(model)); }