Hi,
assuming I have a Child and Parent object each of which has a repository and a controller.
Update: A Parent has many Child objects.
the parent's controller for creating would look something like. the post to create will be made using the auto-generated form.
public ActionResult Create()
{
return View();
}
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(Parent parent)
{
var parentRepo = new ParentRepository();
parentRepo.Save(parent);
return View();
}
how would I go creating a child after I have created the parent?
1) one solution would be using a url like child/create/{idParent}
2) or even embedding the parent id in the child creating form so it is posted with the rest of the child data.
Both seem not in the spirit of MVC.