Esempio n. 1
0
        public async Task <ActionResult> Index()
        {
            var amendments = await _amendmentService.GetAllAsync();

            var model = _mapper.Map <List <AmendmentDetailsViewModel> >(amendments);

            ViewBag.Languages = await _languageDataService.GetAllAsync();

            return(View(model));
        }
        public async Task <ActionResult> Create(int amendmentId, int?languageId)
        {
            var bodies = await _amendmentBodyService.GetByAmentmentId(amendmentId);

            var alreadyCreatedLanguageIds = bodies.Select(b => b.LanguageId).ToList();

            var model = new AmendmentBodyEditViewModel()
            {
                AmendId = amendmentId
            };

            model.LanguageId = languageId ?? 0;

            model.Languages = (await _languageDataService.GetAllAsync()).Where(l => alreadyCreatedLanguageIds.All(c => c != l.Id)).ToList();
            return(View(model));
        }
Esempio n. 3
0
        public async Task <IActionResult> Index()
        {
            var languageList = await _languageService.GetAllAsync();

            var amendment = await _amendmentService.GetLiveAsync() ?? new Model.DataModel.Amendment();

            var amendmentBody = amendment.AmendmentBodies;

            var amendmentModel     = _mapper.Map <AmendmentViewViewModel>(amendment);
            var amendmentBodyModel = _mapper.Map <List <AmendmentBodyViewViewModel> >(amendmentBody);

            var model = new HomeScreenViewViewModel()
            {
                Languages       = languageList,
                Amendment       = amendmentModel,
                AmendmentBodies = amendmentBodyModel
            };

            return(View(model));
        }