public ActionResult Edit(int agentId)
 {
     AgentRepository repository = new AgentRepository();
     var agent = repository.GetById(agentId);
     var agentToEdit = new EditAgent { agentId = agent.id, agentName = agent.name };
     return View(agentToEdit);
 }
        public ActionResult Edit(int agentId, EditAgent agent)
        {
            AgentRepository repository = new AgentRepository();

            Agents agentToUpdate = new Agents
            {
                id = agent.agentId,
                Contracts = repository.GetById(agentId).Contracts,
                name = agent.agentName
            };

            repository.Update(agentToUpdate);
            return RedirectToAction("Index");
        }