Esempio n. 1
0
        public IActionResult Create(PersonEditViewModel model)
        {
            if (ModelState.IsValid)
            {
                string[] split = model.Name.Split(new char[0]);

                var newPerson = new Person();
                newPerson.FirstName = split[0];
                newPerson.LastName  = split[1];
                newPerson.Interests = model.Interests;
                newPerson.Birth     = model.Birth;

                newPerson = _peopleData.Add(newPerson);
                _peopleData.Commit();

                return(RedirectToAction("Search"));
            }
            return(View());
        }