public ActionResult Edit(Guid visitId, Guid patientId) { var baseObject = GetBaseObject(); var visit = _visitService.Get(visitId); var patient = _patientService.Get(patientId); IList <Application.EntityViews.MeasurementTool> measurementTools = _visitService.GetMeasurementToolsOfVisit(visitId); IList <Application.EntityViews.TeamMember> teamMembers = _patientService.ListTeamMembers(patientId); IList <Guid> scoreValues = _visitService.GetVisitScoreValues(visitId); if (!patient.CanAccess(baseObject.User, teamMembers, baseObject.User.Permissions)) { throw new BusinessRuleException("You are not autorized to view this patient"); } return(View(new ViewObjects.Visit.Create(baseObject) { Visit = visit, Patient = patient, MeasurementTools = measurementTools, ScoreValues = scoreValues.ToArray() })); }