コード例 #1
0
        public async Task <ActionResult> Edit(int id, AmendmentEditViewModel model)
        {
            var amendment = await _amendmentService.GetAsync(id);

            if (amendment == null)
            {
                return(NotFound());
            }

            if (!ModelState.IsValid)
            {
                model.Languages = await _languageDataService.GetAllAsync();

                return(View(model));
            }

            amendment = _mapper.Map(model, amendment);
            await _amendmentService.UpdateAsync(amendment, User.UserId());

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