Beispiel #1
0
        public async Task <BaseDtoListResponse <CompanyRoleDto> > ListAsync()
        {
            try
            {
                IList <CompanyRole> roles = await _companyRoleRepository.ListAll();

                if (roles != null)
                {
                    IList <CompanyRoleDto> result = _mapper.Map <IList <CompanyRole>, IList <CompanyRoleDto> >(roles);
                    BaseDtoListResponse <CompanyRoleDto> response = new BaseDtoListResponse <CompanyRoleDto>(result);
                    return(response);
                }
                else
                {
                    return(new BaseDtoListResponse <CompanyRoleDto>("No Roles found, please try after adding new role(s)"));
                }
            }
            catch (Exception ex)
            {
                return(new BaseDtoListResponse <CompanyRoleDto>(ex.Message));
            }
        }
Beispiel #2
0
        public async Task <BaseDtoListResponse <FoodItemDto> > ListAsync()
        {
            try
            {
                IList <FoodItem> items = await _foodItemRepository.ListAll();

                if (items != null)
                {
                    IList <FoodItemDto> result = _mapper.Map <IList <FoodItem>, IList <FoodItemDto> >(items);
                    BaseDtoListResponse <FoodItemDto> response = new BaseDtoListResponse <FoodItemDto>(result);
                    return(response);
                }
                else
                {
                    return(new BaseDtoListResponse <FoodItemDto>("No Items found, please try after adding new food item(s)"));
                }
            }
            catch (Exception ex)
            {
                return(new BaseDtoListResponse <FoodItemDto>(ex.Message));
            }
        }
Beispiel #3
0
        public async Task <BaseDtoListResponse <ProductDto> > ListAsync()
        {
            try
            {
                IList <Product> products = await _productRepository.ListAll();

                if (products != null)
                {
                    IList <ProductDto> result = _mapper.Map <IList <Product>, IList <ProductDto> >(products);
                    BaseDtoListResponse <ProductDto> response = new BaseDtoListResponse <ProductDto>(result);
                    return(response);
                }
                else
                {
                    return(new BaseDtoListResponse <ProductDto>("Something went wrong, please try again"));
                }
            }
            catch (Exception ex)
            {
                return(new BaseDtoListResponse <ProductDto>(ex.Message));
            }
        }
Beispiel #4
0
        public async Task <BaseDtoListResponse <FoodCategoryDto> > ListAsync()
        {
            try
            {
                IList <FoodCategory> categories = await _foodCategoryRepository.ListAll();

                if (categories != null)
                {
                    IList <FoodCategoryDto> result = _mapper.Map <IList <FoodCategory>, IList <FoodCategoryDto> >(categories);
                    BaseDtoListResponse <FoodCategoryDto> response = new BaseDtoListResponse <FoodCategoryDto>(result);
                    return(response);
                }
                else
                {
                    return(new BaseDtoListResponse <FoodCategoryDto>("No Categories found, please try after adding new categories(s)"));
                }
            }
            catch (Exception ex)
            {
                return(new BaseDtoListResponse <FoodCategoryDto>(ex.Message));
            }
        }