public async Task <string> ChangeStandard(ChangeAllViewModel change) { var list = await dataContext.Cells.AsNoTracking().Where(x => x.StandardId == change.OldId).ToListAsync(); for (int i = 0; i < list.Count; i++) { list[i].StandardId = change.NewId; dataContext.Cells.Update(list[i]); } return(await SaveAsync()); }
public async Task <IActionResult> _ChangeStandard(ChangeAllViewModel change) { if (!ModelState.IsValid) { return(View(change)); } var result = await _standartRepository.ChangeStandard(change); if (result != null) { ModelState.AddModelError("", result); return(View("_ChangeStandard", change)); } return(View(nameof(GetStandart), new { id = change.OldId })); }