Пример #1
0
        public IActionResult Index()
        {
            var magazineCategories = _magCatService.GetAllMagazineCategories();

            if (!magazineCategories.IsOk())
            {
                TempData["ErrorMessage"] = string.Format("Hiba a lekérés során ({0} : {1})", magazineCategories.Status, magazineCategories.StatusText);
                return(View(new MagazineVM()));
            }

            var tags = _magService.GetAllTags();

            if (!tags.IsOk())
            {
                TempData["ErrorMessage"] = string.Format("Hiba a lekérés során ({0} : {1})", tags.Status, tags.Message);
                return(View(new MagazineVM()));
            }

            var magazines = _magService.GetAllMagazines();

            if (!magazines.IsOk())
            {
                TempData["ErrorMessage"] = string.Format("Hiba a lekérés során ({0} : {1})", tags.Status, tags.Message);
                return(View(new MagazineVM()));
            }

            var mapper = _mapper.Map <MagazineVM>(magazineCategories.Data).Map(tags.Data).Map(magazines.Data);

            return(View(mapper));
        }