public async Task <IActionResult> AddInnovation(int id) { SelectedInnovationViewModel selectedInnovationViewModel = new SelectedInnovationViewModel { Innovations = await _countryService.ListCountryAvailableInnovationsAsync(id), Id = id }; return(View(selectedInnovationViewModel)); }
public async Task <IActionResult> AddInnovation(SelectedInnovationViewModel selectedInnovationViewModel) { if (ModelState.IsValid) { try { await _countryService.AddInnovationAsync(selectedInnovationViewModel.Id, selectedInnovationViewModel.InnovationId); return(RedirectToAction("Details", new { @id = selectedInnovationViewModel.Id })); } catch (GameException e) { ModelState.AddModelError(e.Key, e.Description); } } selectedInnovationViewModel.Innovations = await _countryService.ListCountryAvailableInnovationsAsync(selectedInnovationViewModel.Id); return(View(selectedInnovationViewModel)); }