Exemplo n.º 1
0
        public async Task <object> Index()
        {
            int id = Convert.ToInt32(HttpContext.Request.Query["id"]);

            if (id >= 0)
            {
                DrcCardContainerViewModel drcCardContainerViewModel = new DrcCardContainerViewModel();
                DrcCardViewModel          drcCardViewModel;
                if (id >= 0)
                {
                    var tempCards = await _drcCardService.GetAllDrcCards(id);

                    foreach (var card in tempCards)
                    {
                        drcCardViewModel = _mapper.Map <DrcCardViewModel>(card);


                        foreach (var responsibilityBusinessModel in _drcCardService.getListOfDrcCardResponsibilities(card.Id))
                        {
                            drcCardViewModel.Responsibilities.Add(_mapper.Map <ResponsibilityViewModel>(responsibilityBusinessModel));
                        }


                        foreach (var fieldBusinessModel in _drcCardService.getListOfDrcCardFields(card.Id, card.MainCardId))
                        {
                            drcCardViewModel.Fields.Add(_mapper.Map <FieldViewModel>(fieldBusinessModel));
                        }


                        foreach (var authorizationBusinessModel in _drcCardService.getListOfDrcCardAuthorizations(card.Id))
                        {
                            drcCardViewModel.Authorizations.Add(_mapper.Map <AuthorizationViewModel>(authorizationBusinessModel));
                        }

                        drcCardViewModel.SourceDrcCardPath = _drcCardService.GetShadowCardSourcePath(card.MainCardId);
                        drcCardContainerViewModel.DrcCardViewModes.Add(drcCardViewModel);
                    }


                    drcCardContainerViewModel.DrcCardViewModel.SubdomainVersionId = id;
                }
                drcCardContainerViewModel.TotalSubdomainSize       = _drcCardService.TotalSubdomainSize();
                drcCardContainerViewModel.IsSubdomainVersionLocked = _drcCardService.isSubdomainVersionLocked(id);


                return(View(drcCardContainerViewModel));
            }
            else
            {
                ViewData["Message"]            = "version Id passed as negatif number";
                ViewData["SubdomainVersionId"] = 0;

                return(View("ErrorPage"));
            }
        }
Exemplo n.º 2
0
        public async Task <object> Presentation(string searchText)
        {
            String querySubdomain = HttpContext.Request.Query["subdomain"];
            String queryVersion   = HttpContext.Request.Query["version"];

            DrcCardContainerViewModel drcCardContainerViewModel = new DrcCardContainerViewModel();
            int id = _drcCardService.getVersionIdFromQueryString(querySubdomain, queryVersion);

            if (id > 0)
            {
                if (id != 0)
                {
                    var tempCards = await _drcCardService.GetAllDrcCards(id);

                    foreach (var card in tempCards)
                    {
                        DrcCardViewModel drcCardViewModel = _mapper.Map <DrcCardViewModel>(card);


                        foreach (var responsibilityBusinessModel in _drcCardService.getListOfDrcCardResponsibilities(card.Id))
                        {
                            drcCardViewModel.Responsibilities.Add(_mapper.Map <ResponsibilityViewModel>(responsibilityBusinessModel));
                        }


                        foreach (var fieldBusinessModel in _drcCardService.getListOfDrcCardFields(card.Id, card.MainCardId))
                        {
                            drcCardViewModel.Fields.Add(_mapper.Map <FieldViewModel>(fieldBusinessModel));
                        }


                        foreach (var authorizationBusinessModel in _drcCardService.getListOfDrcCardAuthorizations(card.Id))
                        {
                            drcCardViewModel.Authorizations.Add(_mapper.Map <AuthorizationViewModel>(authorizationBusinessModel));
                        }

                        drcCardViewModel.SourceDrcCardPath = _drcCardService.GetShadowCardSourcePath(card.MainCardId);
                        drcCardContainerViewModel.DrcCardViewModes.Add(drcCardViewModel);
                    }

                    drcCardContainerViewModel.PresentationHeader = _drcCardService.GetPresentationHeader(id);
                    drcCardContainerViewModel.DrcCardViewModel.SubdomainVersionId = id;
                }
                return(View(drcCardContainerViewModel));
            }

            drcCardContainerViewModel.ErrorMessage = "The address you entered is not available";

            return(View(drcCardContainerViewModel));
        }