Esempio n. 1
0
        public async Task <IEnumerable <BllItem> > GetUserToDoItems(int id)
        {
            var listIds  = (await _listRep.GetAll()).Where(t => t.OwnerId == id).Select(t => t.Id);
            var bllItems = new List <BllItem>();

            foreach (var item in listIds)
            {
                //незнание порождает демонов сознания
                bllItems.AddRange((await _itemRep.GetAll()).Where(t => t.DalListId == item).Select(Mapper.ToBllItem));
            }
            return(bllItems);
        }
Esempio n. 2
0
        public AppQuery(
            ILabRepository labRepository,
            IProjectRepository projectRepository,
            IListRepository listRepository,
            ISeriesRepository seriesRepository,
            IPointRepository pointRepository)
        {
            #region GetAll
            Field <ListGraphType <LabType> >(
                "labs",
                resolve: context => labRepository.GetAll()
                );

            Field <ListGraphType <ProjectType> >(
                "projects",
                resolve: context => projectRepository.GetAll()
                );

            Field <ListGraphType <ListType> >(
                "lists",
                resolve: context => listRepository.GetAll()
                );

            Field <ListGraphType <SeriesType> >(
                "series",
                resolve: context => seriesRepository.GetAll()
                );

            Field <ListGraphType <PointType> >(
                "points",
                resolve: x => pointRepository.GetAll()
                );
            #endregion
            #region GetById
            Field <LabType>(
                "lab",
                arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "idLab"
            }),
                resolve: context =>
            {
                return(labRepository.GetById(context.GetArgument <int>("idLab")));
            }
                );

            Field <ProjectType>(
                "project",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "idLab"
            },
                    new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "idProject"
            }
                    ),
                resolve: context =>
            {
                return(projectRepository.GetById(
                           context.GetArgument <int>("idLab"),
                           context.GetArgument <int>("idProject")));
            }
                );

            Field <SeriesType>(
                "serie",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "idLab"
            },
                    new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "idProject"
            },
                    new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "idSeries"
            }
                    ),
                resolve: context =>
            {
                return(seriesRepository.GetById(
                           context.GetArgument <int>("idLab"),
                           context.GetArgument <int>("idProject"),
                           context.GetArgument <int>("idSeries")));
            }
                );

            Field <ListType>(
                "list",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "idLab"
            },
                    new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "idProject"
            },
                    new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "idList"
            }
                    ),
                resolve: context =>
            {
                return(listRepository.GetById(
                           context.GetArgument <int>("idLab"),
                           context.GetArgument <int>("idProject"),
                           context.GetArgument <int>("idList")));
            }
                );

            Field <PointType>(
                "point",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "idLab"
            },
                    new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "idProject"
            },
                    new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "idSeries"
            },
                    new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "idPoint"
            }
                    ),
                resolve: context =>
            {
                return(pointRepository.GetById(
                           context.GetArgument <int>("idLab"),
                           context.GetArgument <int>("idProject"),
                           context.GetArgument <int>("idSeries"),
                           context.GetArgument <int>("idPoint")));
            }
                );
            #endregion
        }
Esempio n. 3
0
        public async Task <IActionResult> Index(int id)
        {
            var results = _listRepository.GetAll();

            return(View(await results));
        }
Esempio n. 4
0
 public IEnumerable <List> GetAll()
 {
     return(_listRepository.GetAll());
 }
Esempio n. 5
0
        public async Task <IEnumerable <ListModel> > GetAllLists(string userId)
        {
            var entities = await _listRepository.GetAll(userId);

            return(Mapper.Map <IEnumerable <ListModel> >(entities));
        }
Esempio n. 6
0
 public async Task <IEnumerable <BllList> > GetAllLists() => (await _listRep.GetAll()).Select(Mapper.ToBllList);