Exemplo n.º 1
0
    public ActionResult Create(CreatePersonViewModel create_person)
    {
        if (ModelState.IsValid)
        {
            var name = new Name(create_person.first_name, create_person.last_name);
            var person_to_add = new Person(name);

            using (_unit_of_work_factory.create())
            {                
                _person_repository.save(person_to_add);
            }

            TempData.Add("Message", String.Format("New person added '{0}'", person_to_add.name));

            return RedirectToAction("Index", "DisplayAllPeople");
        }
        else
            return View(create_person);                                        
    }
Exemplo n.º 2
0
 public ActionResult Create()
 {
     var create_person = new CreatePersonViewModel();
         
     return View(create_person);
 }