public ViewResult Edit(Int32? id) { if (id.HasValue && id != 0) { var entity = _service.GetById(id.Value); ViewBag.Title = "Edit Relationship"; ViewBag.PersonRelationshipId = entity.PersonRelationshipId; ViewBag.PersonId = entity.PersonId; ViewBag.RelationshipId = entity.RelationshipId; ViewBag.RelatedPersonId = entity.RelatedPersonId; } else { ViewBag.Title = "Create Relationship"; } var personService = new PersonService(); var relationshipService = new RelationshipService(); var model = new Models.PersonRelationshipEditModel { People = personService.GetAll(), RelatedPeople = personService.GetAll(), Relationships = relationshipService.GetAll() }; return View(model); }
public ActionResult Index() { IPersonService personService = new PersonService(); IPersonRelationshipService relationshipService = new PersonRelationshipService(); var model = new HomeModel { People = personService.GetAll(), Relationships = relationshipService.GetAll() }; return View(model); }