public async Task <IActionResult> Delete(int userId)
        {
            await _adminUserService.Delete(userId, User.GetId());

            await _roleService.DeleteUserRole(userId);

            return(Ok());
        }
        public Entity.BaseResponse <UserResponse> Delete(string id)
        {
            Entity.BaseResponse <UserResponse> response = new Entity.BaseResponse <UserResponse>(true);

            try
            {
                var status = _adminUserService.Delete(Guid.Parse(id));
                response.IsSuccess = true;
                response.Message   = status.Message;
                response.Data      = status.Data;
            }
            catch (Exception ex)
            {
                base.LogException(ex);
                return(new Entity.BaseResponse <UserResponse>(false, ex.Message));
            }

            return(response);
        }
示例#3
0
        public Entity.BaseResponse <UserResponse> Delete(Guid id)
        {
            Entity.BaseResponse <UserResponse> response = new Entity.BaseResponse <UserResponse>(true);

            try
            {
                if (id.Equals(SolutionConfiguration.CurrentUserId))
                {
                    return(new Entity.BaseResponse <UserResponse>(false, "You can't delete your own account!"));
                }
                var status = _adminUserService.Delete(id);
                response.IsSuccess = true;
                response.Message   = status.Message;
                response.Data      = status.Data;
            }
            catch (Exception ex)
            {
                base.LogException(ex);
                return(new Entity.BaseResponse <UserResponse>(false, ex.Message));
            }

            return(response);
        }