public List <Fruit> GetAll()
        {
            var fruits = _fruitService.GetAll();

            _logger.LogInformation("GET response: {@Fruits}", fruits);
            return(fruits);
        }
Exemple #2
0
        public MainWindowViewModel(IFruitService fruitService, IDialogService dialogService)
        {
            FruitService  = fruitService;
            DialogService = dialogService;

            Fruits = new ObservableCollection <string>(FruitService.GetAll());

            PressMeCommand = new DelegateCommand <string>(ShowDialog);
        }
Exemple #3
0
        public async Task <IActionResult> Index(string?fruit, int pagina = 1)
        {
            if (fruit != null)
            {
                return(View(_mapper.Map <List <FruitViewModel> >(await _fruitService.Search(f => f.Name.Contains(fruit))).ToPagedList(pagina, 5)));
            }

            return(View(_mapper.Map <List <FruitViewModel> >(await _fruitService.GetAll()).ToPagedList(pagina, 5)));
        }
 public async Task <ActionResult <IEnumerable <Fruit> > > GetFruits()
 {
     return(Ok(_mapper.Map <List <FruitViewModel> >(await _fruitService.GetAll())));
 }
 public IEnumerable <FruitModel> GetAll()
 {
     return(_mapper.Map <IEnumerable <FruitModel> >(_fruitService.GetAll()));
 }