public async Task <IActionResult> Edit([Bind("Id, Name, Code")] CountryVM country) { if (ModelState.IsValid) { try { await service.UpdateCountryAsync(country.Adapt <CountryDTO>()); } catch (DbUpdateConcurrencyException) { if (!CountryExists(country.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(country)); }
public async Task <IActionResult> Create([Bind("Name, Code")] CountryVM country) { if (ModelState.IsValid) { await service.AddCountryAsync(country.Adapt <CountryDTO>()); return(RedirectToAction(nameof(Index))); } return(View(country)); }