public ActionResult Create(NationalitySinglePageViewModel model) { CreateNationalityRequest request = model.NationalityViewModel.ConvertToCreateNationalityRequest(); CreateNationalityResponse response = _nationalityService.CreateNationality(request); if (response.Success) { return(RedirectToAction("Index")); } else { model.Success = false; model.Message = response.Message; return(View(model)); } }
public CreateNationalityResponse CreateNationality(CreateNationalityRequest request) { CreateNationalityResponse response = new CreateNationalityResponse(); try { Nationality nationality = request.ConvertToNationality(); _nationalityRepository.Create(nationality); response.Success = true; } catch (Exception ex) { response.Success = false; response.Message = ex.Message; } return(response); }