public ActionResult Edit(NationalitySinglePageViewModel model) { if (ModelState.IsValid) { _nationalityService.UpdateNationality(model.NationalityViewModel.ConvertToModel()); return(RedirectToAction("Index")); } return(View(model)); }
public async Task <IActionResult> Put(int id, [FromBody] Nationality nationality) { if (ModelState.IsValid) { var updatedNationality = await nationalityService.UpdateNationality(nationality, id); if (updatedNationality != null) { return(Ok(updatedNationality)); } else { return(BadRequest("Invalid ID!")); } } return(BadRequest()); }