예제 #1
0
        public async Task <IActionResult> ConfirmAction([FromBody] ConfirmActionViewModels model)
        {
            var user = await userManager.GetUserAsync(User);

            var result = await signInManager.CheckPasswordSignInAsync(user, model.Password, false);

            if (result.Succeeded)
            {
                return(new OkObjectResult("Действие принято"));
            }

            return(new BadRequestObjectResult("Пароль неверный"));
        }
예제 #2
0
        public async Task <bool> ConfirmAction(string password)
        {
            string url = HttpService.Url;
            ConfirmActionViewModels model = new ConfirmActionViewModels()
            {
                Password = password
            };

            string      json    = JsonConvert.SerializeObject(model);
            HttpContent content = new StringContent(json, Encoding.UTF8, "application/json");

            var result = await HttpService.Instance.PostAsync(url + "User/ConfirmAction", content);

            if (result.IsSuccessStatusCode)
            {
                return(true);
            }
            else
            {
                Exceptions.Add(new Exception(result.Content.ReadAsStringAsync().Result));
                return(false);
            }
        }