//Get all ingredients
        public List <IngredientDto> GetIngridientsList()
        {
            var ingredients        = this._ingredientRepository.GetList().ToList();
            var ingredientsListDto = new List <IngredientDto>();

            foreach (var ingredient in ingredients)
            {
                ingredientsListDto.Add(DtoBuilder.ToDto(ingredient));
            }
            return(ingredientsListDto);
        }
        //Get categorized ingredients
        public List <IngredientDto> GetIngridientsByCategory(string categoryName)
        {
            var ingredients        = this._ingredientRepository.GetList(i => i.Category.ToString() == categoryName).ToList();
            var ingredientsListDto = new List <IngredientDto>();

            foreach (var ingredient in ingredients)
            {
                ingredientsListDto.Add(DtoBuilder.ToDto(ingredient));
            }
            return(ingredientsListDto);
        }
Exemplo n.º 3
0
        //Get all users pizza templates for Order History Page by user Name
        public List <PizzaItemDto> GetPizzasListByUserFullName(string name)
        {
            var pizzasListDto = new List <PizzaItemDto>();
            var pizzas        = _pizzaRepository.GetList(p => p.Order.User.Name == name).OrderByDescending(p => p.Order.Date).ToList();

            foreach (var pizzaItem in pizzas)
            {
                pizzasListDto.Add(DtoBuilder.ToDto(pizzaItem));
            }
            return(pizzasListDto);
        }
        //Get all pizza templates for Templates Page
        public List <TemplateDto> GetTemplatesList()
        {
            var tempates         = this._templateRepository.GetList().ToList();
            var templatesListDto = new List <TemplateDto>();

            foreach (var template in tempates)
            {
                templatesListDto.Add(DtoBuilder.ToDto(template));
            }
            return(templatesListDto);
        }
Exemplo n.º 5
0
        public List <PizzaItemDto> GetPizzasList()
        {
            var pizzas = _pizzaRepository.GetList().ToList();

            var pizzasListDto = new List <PizzaItemDto>();

            foreach (var pizzaItem in pizzas)
            {
                pizzasListDto.Add(DtoBuilder.ToDto(pizzaItem));
            }
            return(pizzasListDto);
        }
        //Get pizza templates by name for Templates Page
        public List <TemplateDto> GetTemplatesListByName(string name)
        {
            var tempates         = this._templateRepository.GetList(temp => temp.Name.ToLower().Contains(name.ToLower())).ToList();
            var templatesListDto = new List <TemplateDto>();

            foreach (var template in tempates)
            {
                templatesListDto.Add(DtoBuilder.ToDto(template));
            }

            return(templatesListDto);
        }
Exemplo n.º 7
0
        public List <OrderDto> GetOrdersList(int index, int num)
        {
            var      orders        = this._orderRepository.GetList().OrderByDescending(order => order.Date).Skip(index).Take(num).ToList();
            var      ordersListDto = new List <OrderDto>();
            OrderDto orderDto;

            foreach (var order in orders)
            {
                orderDto      = DtoBuilder.ToDto(order);
                orderDto.User = DtoBuilder.ToDto(order.User);
                ordersListDto.Add(orderDto);
            }
            return(ordersListDto);
        }