// GET: PeopleController/Details/5
        public ActionResult Details(int id)
        {
            City city = _citysService.FindBy(id);

            if (city != null)
            {
                return(View(city));
            }
            return(RedirectToAction(nameof(Index)));
        }
        public ActionResult Create(CreatePersonViewModel createPersonViewModel)
        {
            PersonLanguage personLanguage = new PersonLanguage();

            //Person person = new Person();
            if (ModelState.IsValid)
            {
                createPersonViewModel.Country = _countryService.FindBy(createPersonViewModel.Country.Id);
                createPersonViewModel.City    = _citysService.FindBy(createPersonViewModel.City.Id);
                //createPersonViewModel.PersonLanguage = _languageService.FindBy(createPersonViewModel.PersonLanguage.;
                if (createPersonViewModel.City != null && createPersonViewModel.Country != null)
                {
                    _peopleService.Add(createPersonViewModel);
                    return(RedirectToAction(nameof(Index)));
                }
            }

            return(View(createPersonViewModel));
        }
        public IActionResult CreatePerson([FromBody] CreatePersonViewModel createPersonViewModel)
        {
            if (ModelState.IsValid)
            {
                createPersonViewModel.City      = _cityService.FindBy(createPersonViewModel.City.Id);
                createPersonViewModel.Countries = null;
                createPersonViewModel.Country   = null;

                Person person = _peopleService.Add(createPersonViewModel);
                if (person.City != null && person.Languages == null)
                {
                    person.City.Citiezens = null;
                    person.City.Countries = null;
                    person.Languages      = null;
                }
                person.Country = null;
                return(Created("URI to car omitted", person));
            }

            return(BadRequest(createPersonViewModel));
        }