예제 #1
0
        public async Task <ActionResult> Create(AmendmentCreateViewModel model)
        {
            if (!ModelState.IsValid)
            {
                model.Languages = await _languageDataService.GetAllAsync();

                return(View(model));
            }

            var amendment = _mapper.Map <Model.DataModel.Amendment>(model);

            amendment.AmendmentBodies.Add(new AmendmentBody
            {
                AmendBody  = model.AmendBody,
                LanguageId = model.PrimaryLanguageId
            });

            await _amendmentService.CreateAsync(amendment, User.UserId());

            return(RedirectToAction(nameof(Index)));
        }