コード例 #1
0
        //[ValidateModel]
        //  X-XSRF-TOKEN
        public async Task <IActionResult> Add([FromBody][Required] AccountSettings accountModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(new
                {
                    code = 400,
                    message = ModelState.Values.First().Errors.First().ErrorMessage
                }));
            }

            var result = await _userManager.CreateAsync(accountModel.ToAccount(), accountModel.Password);

            return(Json(accountModel));
        }