예제 #1
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var res = await _userAppService.EditUserAsync(UserModel);

            if (res == null)
            {
                return(NotFound());
            }
            else if (res.Succeeded == false)
            {
                foreach (var err in res.Errors)
                {
                    ModelState.AddModelError(err.Code, err.Description);
                }
                return(Page());
            }

            return(RedirectToPage("./Index"));
        }