Esempio n. 1
0
        public async Task <IActionResult> UpdateAccount(UpdateAccountCommand command)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.HasAvatar = _userService.HasAvatar();

                var countryListVm = await Mediator.Send(new GetCountryListQuery());

                ViewBag.Countries = countryListVm.Countries.Select(x => new SelectListItem()
                {
                    Value = x.Id.ToString(),
                    Text  = x.Name
                }).ToList();

                return(View(command));
            }

            await Mediator.Send(command);

            return(RedirectToAction(nameof(UpdateAccount)));
        }