public async Task <IActionResult> BulkCreateResult(AccountBulkCreateViewModel vm) { if (!ModelState.IsValid) { return(View(nameof(BulkCreate), vm)); } // Parse input try { vm.ParseInput(); } catch (InvalidOperationException e) { ModelState.AddModelError(nameof(AccountBulkCreateViewModel.Input), "Parsing error: \r\n" + e.Message); return(View(nameof(BulkCreate), vm)); } try { // Create teams vm.CreateTeams(DbContext, SelectedContestId); // Create accounts await vm.CreateAccounts(DbContext, _mapper).ConfigureAwait(false); } catch (InvalidOperationException e) { ModelState.AddModelError(nameof(AccountBulkCreateViewModel.Input), "Error creating entities: \r\n" + e.Message); return(View(vm)); } return(View(vm)); }
public IActionResult BulkCreateConfirm(AccountBulkCreateViewModel vm) { if (!ModelState.IsValid) { return(View(nameof(BulkCreate), vm)); } try { vm.ParseInput(); } catch (InvalidOperationException e) { ModelState.AddModelError(nameof(AccountBulkCreateViewModel.Input), "Parsing error: \r\n" + e.Message); return(View(nameof(BulkCreate), vm)); } return(View(vm)); }