Example #1
0
        static public bool IsProductType(string productType)
        {
            IProductTypeRepository repository = ProductTypeRepositoryFactory.GetProductTypeRepository();
            var allProductTypes = repository.GetProductTypes();

            return(allProductTypes.Any(t => t.Type.ToUpper() == productType.ToUpper()));
        }
Example #2
0
        static public ProductType GetProductType(string productType)
        {
            IProductTypeRepository repository = ProductTypeRepositoryFactory.GetProductTypeRepository();
            var allProductTypes = repository.GetProductTypes();

            return(allProductTypes.FirstOrDefault(t => t.Type.ToUpper() == productType.ToUpper()));
        }
        public async Task <IActionResult> GetProductTypes()
        {
            var types = await _repo.GetProductTypes();

            var typesForView = _mapper.Map <IEnumerable <ProductTypeForViewDto> >(types);

            return(Ok(typesForView));
        }
        public async Task <ActionResult <IEnumerable <ProductType> > > GetProductTypes()
        {
            var types = await _productTypeRepo.GetProductTypes();

            if (!types.Any())
            {
                return(NotFound());
            }

            return(Ok(types.ToList()));
        }
        public async Task <ActionResult <IReadOnlyList <ProductType> > > GetProductTypes()
        {
            var productTypes = await _productTypeRepository.GetProductTypes();

            if (productTypes != null && productTypes.Count > 0)
            {
                return(Ok(productTypes));
            }

            return(NoContent());
        }
        public async Task <IActionResult> GetProductTypes([FromQuery] ProductTypeQueryResource filterResource)
        {
            if (!_auth.IsValidUser(User))
            {
                return(NoContent());
            }

            // if (filterResource.PageSize == 0)
            //     filterResource.PageSize = 10;


            var filter = _mapper.Map <ProductTypeQueryResource, MdaProductTypeQuery>(filterResource);

            var productTypes = await _repo.GetProductTypes(filter);

            Response.AddPagination(productTypes.CurrentPage, productTypes.PageSize,
                                   productTypes.TotalCount, productTypes.TotalPages);

            var productTypesList = _mapper.Map <IEnumerable <ProductTypeForList> >(productTypes);

            return(Ok(productTypesList));
        }
Example #7
0
 public IActionResult Get()
 {
     try
     {
         var productTypes = _productTypeRepository.GetProductTypes();
         var results      = Mapper.Map <IEnumerable <ProductTypeDto> >(productTypes);
         return(Ok(results));
     }
     catch (Exception ex)
     {
         _logger.LogError($"Failed in Get /ProductTypes: {ex}");
         return(BadRequest());
     }
 }
Example #8
0
        public static List <ProductType> GetAllProductTypes()
        {
            IProductTypeRepository repository = ProductTypeRepositoryFactory.GetProductTypeRepository();

            return(repository.GetProductTypes());
        }
Example #9
0
 public IEnumerable <ProductType> GetProductTypes()
 {
     return(productTypeRepository.GetProductTypes());
 }
        public async Task <ActionResult <ProductType> > GetProductTypes()
        {
            var product = await _repository.GetProductTypes();

            return(Ok(product));
        }