public ActionResult Edit(int id) { Client client = clientRepository.Get(id); IList <Policy> clientPolicies = policyRepository.GetByClient(id); ViewBag.Policies = policyRepository.Get().Except(clientPolicies).Select(policy => new SelectListItem { Text = policy.Name, Value = policy.Id.ToString() }); if (client == null) { return(HttpNotFound()); } return(View(client)); }
public IList <Policy> GetByClient(int clientId) { return(policyRepository.GetByClient(clientId)); }