public ActionResult MakeContract(MakeContractModel contract)
        {
            Clients client;

            //если клиент с таким именем уже существует, то берем его
            //если нет то создаем новый
            try
            {
                client = new ClientRepository()
                   .GetAll()
                   .Where(x => x.name.TrimEnd() == contract.clientName).First();
            }
            catch
            {
                //создаем клиента
                client = new Clients
                {
                    name = contract.clientName
                };
            }

            Projects project = new Projects
            {
                description = contract.projectDescription,
                name = contract.projectName,
                deadline = DateTime.Now.AddDays(20.0)
            };

            Agents agent = new AgentRepository().GetAll().Where(x => x.name.TrimEnd() == contract.agentName).First();

            Builders builder = new BuilderRepository().GetAll().Where(x => x.name.TrimEnd() == contract.builderName).First();

            Contracts contractToAdd = new Contracts()
            {
                agentId = agent.id,
                builderId = builder.id,
                clientId = client.id,
                Clients = client,
                projectId = project.id,
                Projects = project
            };

            new ContractRepository().Save(contractToAdd);

            return RedirectToAction("Index");
        }
 partial void DeleteClients(Clients instance);
 partial void UpdateClients(Clients instance);
 partial void InsertClients(Clients instance);