Exemplo n.º 1
0
        public async Task <object> GetBuildingByIngredientAndBatch(string ingredient, string batchValue)
        {
            var ingredientName = ingredient.ToSafetyString();
            var from           = DateTime.Now.Date.AddDays(-3).Date;
            var to             = DateTime.Now.Date.Date;
            var plans          = _repoPlan.FindAll()
                                 .Include(x => x.Building)
                                 .Include(x => x.BPFCEstablish)
                                 .ThenInclude(x => x.Glues)
                                 .Where(x => x.DueDate.Date >= from && x.DueDate.Date <= to)
                                 .Select(x => new
            {
                x.BPFCEstablish.Glues,
                Line = x.Building.ParentID,
                x.DueDate
            });
            var lines = new List <int?>();

            foreach (var plan in plans)
            {
                // lap nhung bpfc chua ingredient search
                foreach (var glue in plan.Glues.Where(x => x.isShow == true && x.Name.Contains(ingredientName.Trim())))
                {
                    lines.Add(plan.Line);
                }
            }
            var listBuilding = lines.Distinct();
            var buildings    = await _repoBuilding.FindAll().Where(x => listBuilding.Contains(x.ID)).ToListAsync();

            return(buildings);
        }
Exemplo n.º 2
0
        //Lấy danh sách Brand và phân trang
        public async Task <PagedList <PlanDto> > GetWithPaginations(PaginationParams param)
        {
            var lists = _repoPlan.FindAll().ProjectTo <PlanDto>(_configMapper).OrderByDescending(x => x.ID);

            return(await PagedList <PlanDto> .CreateAsync(lists, param.PageNumber, param.PageSize));
        }