Exemplo n.º 1
0
        public async Task <PagedList <IngredientDto> > GetIngredientsWithPaginations(PaginationParams param, int glueid)
        {
            var glueIngredient = _repoGlueIngredient.GetAll();
            var lists          = _repoIngredient.FindAll().Where(x => x.isShow == true).ProjectTo <IngredientDto>(_configMapper).OrderByDescending(x => x.ID).Select(x => new IngredientDto
            {
                ID          = x.ID,
                Name        = x.Name,
                Code        = x.Code,
                CreatedDate = x.CreatedDate,
                Percentage  = glueIngredient.FirstOrDefault(a => a.GlueID == glueid && a.IngredientID == x.ID).Percentage,
                Status      = glueIngredient.Any(a => a.GlueID == glueid && a.IngredientID == x.ID)
            });

            return(await PagedList <IngredientDto> .CreateAsync(lists, param.PageNumber, param.PageSize));
        }
Exemplo n.º 2
0
 public async Task <bool> CheckExistsName(string name)
 {
     return(await _repoIngredient.FindAll().AnyAsync(x => x.Name.Trim().ToLower().Equals(name.Trim().ToLower())));
 }
Exemplo n.º 3
0
 public IEnumerable <Ingredient> FindAll()
 {
     return(_ingredientRepository.FindAll());
 }
Exemplo n.º 4
0
        //Lấy danh sách Ingredient và phân trang
        public async Task <PagedList <IngredientDto> > GetWithPaginations(PaginationParams param)
        {
            var lists = _repoIngredient.FindAll().Include(x => x.Supplier).ProjectTo <IngredientDto>(_configMapper).OrderByDescending(x => x.ID);

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