Exemplo n.º 1
0
        public JsonResult RemoveAccount([FromBody] RemoveAccountRequest request)
        {
            int success = _indexDal.RemoveAccount(request.AccountId);

            if (success > 0)
            {
                return(Json(true));
            }

            return(Json(false));
        }
Exemplo n.º 2
0
        public ActionResult Remove([FromBody] RemoveAccountRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var UserToRemove = new Users {
                UserName = request.UserName, Password = request.Password, Email = request.UserEmail
            };

            _userService.Delete(UserToRemove);
            return(Ok());
        }
        public async Task RemoveAccoutAsync(RemoveAccountRequest request)
        {
            var CurrentUser = await userServices.GetUserByEmailAsync(request.Email);

            if (CurrentUser == null)
            {
                throw new Exception($"User with {request.Email} not found.");
            }
            if (CurrentUser.Email == request.Email && CurrentUser.UserName == request.UserName && BC.Verify(request.Password, CurrentUser.Password))
            {
                await userServices.DeleteAsync(CurrentUser);

                logger.LogInformation($"User [{request.Email}] removed.");
            }
            else
            {
                throw new Exception($"Credentials for '{request.UserName} aren't valid'.");
            }
        }
Exemplo n.º 4
0
 public async Task <IHttpActionResult> Remove([FromUri] RemoveAccountRequest request)
 {
     request.TenantId = (await _userManager.GetUserAsync(User)).TenantId;
     return(Ok(await _mediator.Send(request)));
 }
Exemplo n.º 5
0
 public async Task <IHttpActionResult> Remove([FromUri] RemoveAccountRequest request)
 {
     request.TenantUniqueId = Request.GetTenantUniqueId();
     return(Ok(await _mediator.Send(request)));
 }
Exemplo n.º 6
0
        public async Task <ActionResult> Remove([FromBody] RemoveAccountRequest request)
        {
            await _authenticationService.RemoveAccoutAsync(request);

            return(Ok());
        }