Esempio n. 1
0
        async Task GetList()
        {
            ViewModel          = new FeaturesViewModel();
            ViewModel.Features = new List <Feature>();
            var featureList = await _featureServices.GetFeaturesAsync();

            ViewModel.Features = featureList;
        }
Esempio n. 2
0
        public async Task <IViewComponentResult> InvokeAsync(Guid ChildId)
        {
            UpdateChildFeatureViewModel ViewModel = new UpdateChildFeatureViewModel();

            ViewModel.Features = new List <Feature>();

            var featureList = await _featuresData.GetFeaturesAsync();

            if (featureList.Count > 0)
            {
                List <Feature> newList = new List <Feature>();
                var            child   = await _childData.GetAChildAsync(ChildId);

                if (child.Features.Count > 0)
                {
                    foreach (var item in child.Features)
                    {
                        newList.Add(item.Feature);
                    }

                    foreach (var item in featureList)
                    {
                        if (!newList.Contains(item))
                        {
                            ViewModel.Features.Add(item);
                        }
                    }
                }
                else
                {
                    ViewModel.Features = featureList;
                }
            }

            ViewModel.ChildId = ChildId;
            return(View(ViewModel));
        }