예제 #1
0
        public PersonsQuery(IPersonRepository personRepository, IRelationRepository relationRepository)
        {
            Name = "PersonsRelationsQuery";

            Field <PersonsType>(
                "person",
                arguments: new QueryArguments(new QueryArgument <IntGraphType> {
                Name = "Id"
            }),
                resolve: context => personRepository.GetById(context.GetArgument <int>("Id"))
                );

            Field <ListGraphType <PersonsType> >(
                "persons", "Returns list of persons",
                resolve: context => personRepository.GetAll()
                );

            Field <PersonalRelationsType>(
                "relation",
                arguments: new QueryArguments(new QueryArgument <IntGraphType> {
                Name = "Id"
            }),
                resolve: context => relationRepository.GetById(context.GetArgument <int>("Id"))
                );

            Field <ListGraphType <PersonalRelationsType> >(
                "relations", "returns list of all persons relations",
                resolve: context => relationRepository.GetAll()
                );
        }
예제 #2
0
        private void UpdateGridRelation()
        {
            //Com tempo, mudar para retornar a consulta já com os dados relacionados
            var relations   = relationRepository.GetAll();
            var users       = userRepository.GetAll();
            var enterprises = enterpriseRepository.GetAll();

            var retorno = (from rel in relations
                           join us in users on rel.IdUser equals us.IdUser
                           join en in enterprises on rel.IdEnterprise equals en.IdEnterprise
                           select new
            {
                IdRelation = rel.IdRelation,
                EnterpriseName = en.Name,
                UserName = $"{us.Name} {us.LastName}"
            }).ToList();

            grdRelation.DataSource = retorno.ToList();
            grdRelation.DataBind();
        }
예제 #3
0
        public IEnumerable <Relation> GetAll()
        {
            var entities = repository.GetAll();

            return(entities);
        }
예제 #4
0
 public IEnumerable <Master_Relation> GetAll(Master_Relation obj, string[] param, string spName)
 {
     return(_IRelationRepository.GetAll(obj, param, spName));
 }
예제 #5
0
 public IEnumerable <Relation> GetRelations()
 {
     return(Relation_repo.GetAll().OrderByDescending(a => a.RelationId));
 }