Пример #1
0
        public ServerResult <List <Flower> > GetAll()
        {
            var flowers = _flowersRepo.GetAll();

            return(new ServerResult <List <Flower> >
            {
                Data = flowers.Select(t => t.ToDTO()).ToList(),
                Success = true
            });
        }
        public IActionResult List()
        {
            var flowerVM = new List <FlowerViewModel>();
            var flowers  = _flowerRepository.GetAll();

            listFlowers = flowers.ToList();
            if (flowers.Count() == 0)
            {
                return(View("Empty"));
            }

            foreach (var flower in flowers)
            {
                flowerVM.Add(new FlowerViewModel
                {
                    Flower = flower
                });
            }

            FlowerCount = flowers.Count();
            updateViewBag();
            return(View(flowerVM));
        }