CheckAuthorizationToDeleteUser() public static method

public static CheckAuthorizationToDeleteUser ( ) : void
return void
Example #1
0
        public Result <UserDto> Delete(Guid id)
        {
            Result <UserDto> retResult = Result <UserDto> .Undefined(null);

            try
            {
                Common.CommonHelper.CheckAuthentication();
                DalHelper.CheckAuthorizationToDeleteUser();

                var dto = DeleteImpl(id);
                retResult = Result <UserDto> .Success(dto);
            }
            catch (Exception ex)
            {
                var wrappedEx = new Exceptions.DeleteFailedException(ex);
                retResult = Result <UserDto> .FailureWithInfo(null, wrappedEx);
            }
            return(retResult);
        }
Example #2
0
        public Result <bool?> Delete(string username)
        {
            Result <bool?> retResult = Result <bool?> .Undefined(null);

            try
            {
                Common.CommonHelper.CheckAuthentication();
                DalHelper.CheckAuthorizationToDeleteUser();
                var deleteResult = DeleteImpl(username);
                if (deleteResult == null)
                {
                    throw new Exception();
                }
                retResult = Result <bool?> .Success(deleteResult);
            }
            catch (Exception ex)
            {
                var wrapperEx = new Exceptions.GetUserFailedException(ex, username);
                retResult = Result <bool?> .FailureWithInfo(null, wrapperEx);
            }

            return(retResult);
        }