Esempio n. 1
0
        public IActionResult Index(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            var listingLanguages = _languagesService.GetAllByFrameworkId(id);

            //ova da se sredi ne e voopsto sredeno najdi dali e prazno  isredi gi id-nata
            if (listingLanguages.DefaultIfEmpty(null) == null)
            {
                return(RedirectToAction("Create", new { id = id }));
            }


            var listingModel = listingLanguages.Select(x => new LanguageListingModel
            {
                Id            = x.Id,
                Name          = x.Name,
                Description   = x.Description,
                Documentation = x.Documentation,
                Tutorials     = x.Tutorials,
                Version       = x.Version,
                Progress      = x.Progress
            });
            var model = new LangiageIndexModel
            {
                LanguageListingModel = listingModel,
                FrameworkName        = _frameworkService.GetById(id.Value).Name,
                FrameworkId          = id.Value
            };

            return(View(model));
        }