Beispiel #1
0
        public BaseSearchDto <ProductDetailDto> GetAll(BaseSearchDto <ProductDetailDto> searchDto)
        {
            var productdetailSearch = _repo.GetAll(searchDto);

            var colors   = _colorRepo.GetAll().ToList();
            var sizes    = _sizeRepo.GetAll().ToList();
            var products = _productRepo.GetAll().ToList();

            foreach (ProductDetail c in productdetailSearch.result)
            {
                c.Product = products.Where(s => s.Id == c.ProductId).FirstOrDefault();
                c.Size    = sizes.Where(s => s.Id == c.SizeId).FirstOrDefault();
                c.Color   = colors.Where(s => s.Id == c.ColorId).FirstOrDefault();
            }

            BaseSearchDto <ProductDetailDto> productdetailDtoSearch = new BaseSearchDto <ProductDetailDto> {
                currentPage     = productdetailSearch.currentPage,
                recordOfPage    = productdetailSearch.recordOfPage,
                totalRecords    = productdetailSearch.totalRecords,
                sortAsc         = productdetailSearch.sortAsc,
                sortBy          = productdetailSearch.sortBy,
                createdDateSort = productdetailSearch.createdDateSort,
                pagingRange     = productdetailSearch.pagingRange,
                result          = _mapper.Map <List <ProductDetailDto> >(productdetailSearch.result)
            };

            return(productdetailDtoSearch);
        }
 public IEnumerable <Size> GetListSize(string filter)
 {
     if (!string.IsNullOrEmpty(filter))
     {
         return(_sizeRepository.GetMulti(x => x.Name.Contains(filter)));
     }
     return(_sizeRepository.GetAll());
 }
Beispiel #3
0
        public async Task <IEnumerable <SizeModel> > GetAllSizes()
        {
            var entitiesList = await _repository.GetAll();

            var model = entitiesList?.MapTo <SizeModel>();

            return(model);
        }
Beispiel #4
0
        public GetAllSizesResponse GetAll()
        {
            var response = new GetAllSizesResponse();

            var getAllSizesResponse = _sizeRepository.GetAll();

            if (getAllSizesResponse.HasError)
            {
                response.AddError(getAllSizesResponse.Error);
                return(response);
            }

            response.Sizes = getAllSizesResponse.Sizes.ConvertAll(x => new SizeModel
            {
                Id   = x.Id,
                Name = x.Name
            });

            return(response);
        }
Beispiel #5
0
        public ProductFullDto GetProductFull(int id)
        {
            var product = _productRepo.GetById(id);

            product.SubCategory = _subCategoryRepo.GetById(product.SubCategoryId);

            var productFull = _mapper.Map <ProductFullDto>(product);

            var colors = _colorRepo.GetAll().ToList();
            var sizes  = _sizeRepo.GetAll().ToList();

            var productDetails = _productDetailRepo.GetByProduct(id);

            foreach (ProductDetail d in productDetails)
            {
                d.Color = colors.Where(s => s.Id == d.ColorId).FirstOrDefault();
                d.Size  = sizes.Where(s => s.Id == d.SizeId).FirstOrDefault();
            }
            var productDetailDtos = _mapper.Map <List <ProductDetailDto> >(productDetails);

            productFull.ProductDetails = productDetailDtos;
            return(productFull);
        }
Beispiel #6
0
 public List <Size> GetListSize()
 {
     return(_sizeRepository.GetAll().ToList());
 }
Beispiel #7
0
        public List <Size> GetAllSize()
        {
            List <Size> sizes = _sizeRepository.GetAll().ToList();

            return(sizes);
        }
Beispiel #8
0
 public IEnumerable <Size> GetAll()
 {
     return(sizeRepository.GetAll(new string[] { }));
 }
Beispiel #9
0
 public IEnumerable <Size> GetAll()
 {
     return(_SizeRepository.GetAll());
 }
        public IEnumerable <SizeDto> GetAll()
        {
            var sizes = _repo.GetAll();

            return(_mapper.Map <IEnumerable <SizeDto> >(sizes));
        }