public async Task <IActionResult> Create([Bind("Id,CountryCode,CountryName")] CountryViewmodel Vm) { if (ModelState.IsValid) { var Res = _Mapper.Map <Country>(Vm); await _countryRepository.SaveOrUpdateAsync(Res); return(RedirectToAction(nameof(Index))); } return(View(Vm)); //return CreatedAtAction("GetCountry", new { id = country.Id }, country); }
// GET: Countries/Details/5 public async Task <IActionResult> Details(int?id, CountryViewmodel vm) { if (id == null) { return(NotFound()); } var country = await _countryRepository.GetByIdAsync(id); _Mapper.Map(vm, country); if (country == null) { return(NotFound()); } return(View(_Mapper.Map <CountryViewmodel>(country))); }